Skip to content

Commit

Permalink
8325908: Finish removal of IntlTest and CollatorTest
Browse files Browse the repository at this point in the history
Reviewed-by: naoto
  • Loading branch information
Justin Lu committed Feb 16, 2024
1 parent 5310250 commit 4c7b313
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 47 deletions.
10 changes: 8 additions & 2 deletions test/jdk/java/text/BreakIterator/Bug4533872.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,7 +21,7 @@
* questions.
*/

/**
/*
* @test
* @bug 4533872 4640853
* @summary Unit tests for supplementary character support (JSR-204) and Unicode 4.0 support
Expand Down Expand Up @@ -62,6 +62,7 @@ public class Bug4533872 {
/*
* Test for next(int n)
*/
@Test
void TestNext() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand All @@ -84,6 +85,7 @@ void TestNext() {
/*
* Test for isBoundary(int n)
*/
@Test
void TestIsBoundary() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand Down Expand Up @@ -112,6 +114,7 @@ void TestIsBoundary() {
/*
* Test mainly for next() and current()
*/
@Test
void TestPrintEachForward() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand Down Expand Up @@ -151,6 +154,7 @@ void TestPrintEachForward() {
/*
* Test mainly for previous() and current()
*/
@Test
void TestPrintEachBackward() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand Down Expand Up @@ -190,6 +194,7 @@ void TestPrintEachBackward() {
/*
* Test mainly for following() and previous()
*/
@Test
void TestPrintAt_1() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand Down Expand Up @@ -219,6 +224,7 @@ void TestPrintAt_1() {
/*
* Test mainly for preceding() and next()
*/
@Test
void TestPrintAt_2() {
iter = BreakIterator.getWordInstance(Locale.US);

Expand Down
22 changes: 14 additions & 8 deletions test/jdk/java/text/Collator/APITest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,13 +21,6 @@
* questions.
*/

/*
* @test
* @library /java/text/testlib
* @summary test Collation API
* @modules jdk.localedata
* @run junit APITest
*/
/*
(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
(C) Copyright IBM Corp. 1996 - All Rights Reserved
Expand All @@ -40,6 +33,14 @@
Taligent is a registered trademark of Taligent, Inc.
*/

/*
* @test
* @library /java/text/testlib
* @summary test Collation API
* @modules jdk.localedata
* @run junit APITest
*/

import java.util.Locale;
import java.text.Collator;
import java.text.RuleBasedCollator;
Expand All @@ -59,6 +60,7 @@ final void doAssert(boolean condition, String message)
}
}

@Test
public final void TestProperty( )
{
Collator col = null;
Expand Down Expand Up @@ -134,6 +136,7 @@ public final void TestProperty( )
System.out.println("Collator property test ended.");
}

@Test
public final void TestHashCode( )
{
System.out.println("hashCode tests begin.");
Expand Down Expand Up @@ -175,6 +178,7 @@ public final void TestHashCode( )
//----------------------------------------------------------------------------
// ctor -- Tests the constructor methods
//
@Test
public final void TestCollationKey( )
{
System.out.println("testing CollationKey begins...");
Expand Down Expand Up @@ -214,6 +218,7 @@ public final void TestCollationKey( )
//----------------------------------------------------------------------------
// ctor -- Tests the constructor methods
//
@Test
public final void TestElemIter( )
{
System.out.println("testing sortkey begins...");
Expand Down Expand Up @@ -306,6 +311,7 @@ public final void TestElemIter( )
System.out.println("testing CollationElementIterator ends...");
}

@Test
public final void TestGetAll()
{
Locale[] list = Collator.getAvailableLocales();
Expand Down
19 changes: 15 additions & 4 deletions test/jdk/java/text/Format/DateFormat/DateFormatRoundTripTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,11 +25,22 @@
* @test
* @summary test Date Format (Round Trip)
* @bug 8008577
* @run junit/othervm -Djava.locale.providers=COMPAT,SPI DateFormatRoundTripTest
* @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatRoundTripTest
*/

import java.text.*;
import java.util.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.SimpleTimeZone;
import java.util.TimeZone;

public class DateFormatRoundTripTest {

Expand Down
17 changes: 14 additions & 3 deletions test/jdk/java/text/Format/NumberFormat/BigDecimalFormat.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,8 +30,11 @@

import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.*;
import java.util.*;
import java.text.DecimalFormat;
import java.text.FieldPosition;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.Locale;

import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -98,6 +101,7 @@ public class BigDecimalFormat {
/**
* Test for normal big numbers which have the fraction part
*/
@Test
void test_Format_in_NumberFormat_BigDecimal() {
String from, to;

Expand Down Expand Up @@ -519,6 +523,7 @@ void test_Format_in_NumberFormat_BigDecimal() {
/**
* Test for normal big numbers which have the fraction part with multiplier
*/
@Test
void test_Format_in_NumberFormat_BigDecimal_usingMultiplier() {
String from, to;

Expand Down Expand Up @@ -579,6 +584,7 @@ void test_Format_in_NumberFormat_BigDecimal_usingMultiplier() {
/**
* Test for normal big numbers which don't have the fraction part
*/
@Test
void test_Format_in_NumberFormat_BigInteger() {
String from, to;

Expand Down Expand Up @@ -719,6 +725,7 @@ void test_Format_in_NumberFormat_BigInteger() {
* Test for normal big numbers which don't have the fraction part with
* multiplier
*/
@Test
void test_Format_in_NumberFormat_BigInteger_usingMultiplier() {
String from, to;

Expand Down Expand Up @@ -774,6 +781,7 @@ void test_Format_in_NumberFormat_BigInteger_usingMultiplier() {
* Test for normal Long numbers when maximum and minimum digits are
* specified
*/
@Test
void test_Format_in_NumberFormat_Long_checkDigits() {
String from, to;

Expand Down Expand Up @@ -889,6 +897,7 @@ void test_Format_in_NumberFormat_Long_checkDigits() {
* Double.POSITIVE_INFINITY
* Double.NEGATIVE_INFINITY
*/
@Test
void test_Format_in_NumberFormat_SpecialNumber() {
String from, to;

Expand Down Expand Up @@ -931,6 +940,7 @@ void test_Format_in_NumberFormat_SpecialNumber() {
* (Formatting Long.MIN_VALUE w/ multiplier=-1 used to return a wrong
* number.)
*/
@Test
void test_Format_in_NumberFormat_Other() {
String from, to;

Expand Down Expand Up @@ -963,6 +973,7 @@ void test_Format_in_NumberFormat_Other() {
/**
* Test for MessageFormat
*/
@Test
void test_Format_in_MessageFormat() {
MessageFormat mf = new MessageFormat(
" {0, number}\n" +
Expand Down
39 changes: 15 additions & 24 deletions test/jdk/java/text/Format/NumberFormat/DFSExponential.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -21,7 +21,7 @@
* questions.
*/

/**
/*
* @test
* @bug 4068067
* @summary test NumberFormat with exponential separator symbols. It also tests the new
Expand All @@ -30,37 +30,32 @@
* @run junit DFSExponential
*/

import java.util.*;
import java.text.*;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.fail;

public class DFSExponential
{

public class DFSExponential {

public void DFSExponenTest() throws Exception {
@Test
public void TestDFSExponential() {
DecimalFormatSymbols sym = new DecimalFormatSymbols(Locale.US);
String pat[] = { "0.####E0", "00.000E00", "##0.####E000", "0.###E0;[0.###E0]" };
double val[] = { 0.01234, 123456789, 1.23e300, -3.141592653e-271 };
long lval[] = { 0, -1, 1, 123456789 };
String valFormat[][] = {
String[] pat = { "0.####E0", "00.000E00", "##0.####E000", "0.###E0;[0.###E0]"};
double[] val = { 0.01234, 123456789, 1.23e300, -3.141592653e-271};
String[][] valFormat = {
{"1.234x10^-2", "1.2346x10^8", "1.23x10^300", "-3.1416x10^-271"},
{"12.340x10^-03", "12.346x10^07", "12.300x10^299", "-31.416x10^-272"},
{"12.34x10^-003", "123.4568x10^006", "1.23x10^300", "-314.1593x10^-273"},
{"1.234x10^-2", "1.235x10^8", "1.23x10^300", "[3.142x10^-271]"},
};


int ival = 0, ilval = 0;
System.out.println("Default exponent separator: "+sym.getExponentSeparator());
try {
sym.setExponentSeparator("x10^");
} catch (NullPointerException e){
fail("null String was passed to set an exponent separator symbol");
throw new RuntimeException("Test Malfunction: null String was passed to set an exponent separator symbol" );
}
System.out.println("Current exponent separator: "+sym.getExponentSeparator());

Expand All @@ -69,19 +64,15 @@ public void DFSExponenTest() throws Exception {
System.out.println(" Pattern: " + fmt.toPattern());
String locPattern = fmt.toLocalizedPattern();
System.out.println(" Localized pattern: "+locPattern);
//fmt.applyLocalizedPattern(locPattern);
//System.out.println(" fmt.applyLocalizedPattern(): "+fmt.toLocalizedPattern());

for (int v=0; v<val.length; ++v) {
String s = fmt.format(val[v]);
System.out.println(" " + val[v]+" --> "+s);
if(valFormat[p][v].equals(s)){
if (valFormat[p][v].equals(s)){
System.out.println(": Passed");
}else{
} else{
fail(" Failed: Should be formatted as "+valFormat[p][v]+ "but got "+s);
throw new RuntimeException(" Failed: Should be formatted as "+valFormat[p][v]+ "but got "+s);
}
}
} //end of the first for loop
}
}
}
}
4 changes: 3 additions & 1 deletion test/jdk/java/text/Format/NumberFormat/DFSSerialization.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -48,6 +48,8 @@
import static org.junit.jupiter.api.Assertions.fail;

public class DFSSerialization{

@Test
public void TestDFSSerialization(){
/*
* 1. read from the object created using jdk1.4.2
Expand Down
9 changes: 4 additions & 5 deletions test/jdk/java/util/TimeZone/Bug4322313.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,9 +30,8 @@
* @run junit Bug4322313
*/

import java.io.*;
import java.text.*;
import java.util.*;
import java.util.Locale;
import java.util.TimeZone;

import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -84,6 +83,7 @@ public class Bug4322313 {
"GMT+09:00 ",
};

@Test
void Test4322313() {
Locale savedLocale = Locale.getDefault();
TimeZone savedTimeZone = TimeZone.getDefault();
Expand Down Expand Up @@ -227,5 +227,4 @@ void Test4322313() {
System.out.println("TimeZone.getTimeZone() test passed");
}
}

}

3 comments on commit 4c7b313

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 4c7b313 Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 4c7b313 Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-4c7b313e in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 4c7b313e from the openjdk/jdk repository.

The commit being backported was authored by Justin Lu on 16 Feb 2024 and was reviewed by Naoto Sato.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-4c7b313e:backport-GoeLin-4c7b313e
$ git checkout backport-GoeLin-4c7b313e
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-4c7b313e

Please sign in to comment.