Skip to content

Commit

Permalink
ICU-22505 Ensure default TZ remains unchanged by each test
Browse files Browse the repository at this point in the history
See #2670
  • Loading branch information
echeran committed Oct 16, 2023
1 parent ca631ea commit 3c44e03
Show file tree
Hide file tree
Showing 179 changed files with 523 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.ibm.icu.util.ULocale;

@RunWith(JUnit4.class)
public class TestLocaleNamePackaging extends TestFmwk {
public class TestLocaleNamePackaging extends CoreTestFmwk {
public TestLocaleNamePackaging() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.calendar;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
Expand All @@ -21,7 +22,6 @@
import com.ibm.icu.dev.test.TestDataModule;
import com.ibm.icu.dev.test.TestDataModule.DataMap;
import com.ibm.icu.dev.test.TestDataModule.TestData;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.dev.test.util.CalendarFieldsSet;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
Expand All @@ -40,7 +40,7 @@
*
*/
@RunWith(JUnitParamsRunner.class)
public class DataDrivenCalendarTest extends TestFmwk {
public class DataDrivenCalendarTest extends CoreTestFmwk {

public DataDrivenCalendarTest() {
//super("com/ibm/icu/dev/data/testdata/", "calendar");
Expand All @@ -54,7 +54,6 @@ private List<TestDataPair> getTestData() throws Exception {
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.ModuleTest#processModules()
*/
@Ignore // TODO(ICU-22505)
@Test
@Parameters(method="getTestData")
public void calendarTest(TestDataPair pair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand All @@ -28,7 +29,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.impl.number.DecimalFormatProperties;
import com.ibm.icu.impl.number.PatternStringParser;
import com.ibm.icu.text.CompactDecimalFormat;
Expand All @@ -41,7 +41,7 @@
import com.ibm.icu.util.ULocale;

@RunWith(JUnit4.class)
public class CompactDecimalFormatTest extends TestFmwk {
public class CompactDecimalFormatTest extends CoreTestFmwk {
Object[][] EnglishTestData = {
// default is 2 digits of accuracy
{0.0d, "0"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
Expand All @@ -23,7 +24,6 @@
import com.ibm.icu.dev.test.TestDataModule;
import com.ibm.icu.dev.test.TestDataModule.DataMap;
import com.ibm.icu.dev.test.TestDataModule.TestData;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.dev.test.util.CalendarFieldsSet;
import com.ibm.icu.dev.test.util.DateTimeStyleSet;
import com.ibm.icu.text.DateFormat;
Expand All @@ -41,7 +41,7 @@
*
*/
@RunWith(JUnitParamsRunner.class)
public class DataDrivenFormatTest extends TestFmwk {
public class DataDrivenFormatTest extends CoreTestFmwk {

/**
* @param baseName
Expand All @@ -59,7 +59,6 @@ private List<TestDataPair> getTestData() throws Exception {
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.ModuleTest#processModules()
*/
@Ignore // TODO(ICU-22505)
@Test
@Parameters(method="getTestData")
public void formatTest(TestDataPair pair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -69,7 +70,7 @@
import com.ibm.icu.util.VersionInfo;

@RunWith(JUnit4.class)
public class DateFormatTest extends TestFmwk {
public class DateFormatTest extends CoreTestFmwk {
/**
* Verify that patterns have the correct values and could produce the
* the DateFormat instances that contain the correct localized patterns.
Expand Down Expand Up @@ -614,7 +615,6 @@ public void TestGeneral() {
expect(DATA, new Locale("en", "", ""));
}

@Ignore // TODO(ICU-22505)
@Test
public void TestGenericTime() {

Expand Down Expand Up @@ -720,7 +720,6 @@ public void TestGenericTime() {

}

@Ignore // TODO(ICU-22505)
@Test
public void TestGenericTimeZoneOrder() {
// generic times should parse the same no matter what the placement of the time zone string
Expand Down Expand Up @@ -2202,7 +2201,6 @@ public void TestDateFormatNone() {
/**
* Test DateFormat(Calendar) API
*/
@Ignore // TODO(ICU-22505)
@Test
public void TestDateFormatCalendar() {
DateFormat date=null, time=null, full=null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.text.AttributedCharacterIterator;
import java.text.FieldPosition;
import java.text.Format;
Expand All @@ -38,11 +39,12 @@
// try to test the full functionality. It just calls each function in the class and
// verifies that it works on a basic level.
@RunWith(JUnit4.class)
public class IntlTestDecimalFormatAPIC extends TestFmwk {
public class IntlTestDecimalFormatAPIC extends CoreTestFmwk {

// This test checks various generic API methods in DecimalFormat to achieve 100% API coverage.
@Test
public void TestAPI() {
Locale startLocale = Locale.getDefault();

logln("DecimalFormat API test---");
logln("");
Expand Down Expand Up @@ -250,6 +252,7 @@ public void TestAPI() {
// errln("ERROR: Couldn't create a DecimalFormat");
// }

Locale.setDefault(startLocale);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.text.FieldPosition;
import java.util.Locale;

Expand All @@ -29,7 +30,7 @@
* Tests for DecimalFormatSymbols
**/
@RunWith(JUnit4.class)
public class IntlTestDecimalFormatSymbolsC extends TestFmwk {
public class IntlTestDecimalFormatSymbolsC extends CoreTestFmwk {
/**
* Test the API of DecimalFormatSymbols; primarily a simple get/set set.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -60,7 +61,7 @@
* @author markdavis
*/
@RunWith(JUnit4.class)
public class MeasureUnitTest extends TestFmwk {
public class MeasureUnitTest extends CoreTestFmwk {

static class OrderedPair<F extends Comparable, S extends Comparable> extends Pair<F, S> implements Comparable<OrderedPair<F, S>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
Expand All @@ -38,7 +39,7 @@
* Performs regression test for MessageFormat
**/
@RunWith(JUnit4.class)
public class NumberFormatRegressionTest extends TestFmwk {
public class NumberFormatRegressionTest extends CoreTestFmwk {
/**
* alphaWorks upgrade
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -24,7 +25,7 @@
*
*/
@RunWith(JUnit4.class)
public class NumberFormatSpecificationTest extends TestFmwk {
public class NumberFormatSpecificationTest extends CoreTestFmwk {
@Test
public void TestBasicPatterns() {
double num = 1234.567;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.dev.test.CoreTestFmwk;
import com.ibm.icu.dev.test.TestUtil;
import com.ibm.icu.dev.test.format.IntlTestDecimalFormatAPIC.FieldContainer;
import com.ibm.icu.impl.DontCareFieldPosition;
Expand Down Expand Up @@ -69,7 +69,7 @@
import com.ibm.icu.util.ULocale;

@RunWith(JUnit4.class)
public class NumberFormatTest extends TestFmwk {
public class NumberFormatTest extends CoreTestFmwk {

@Test
public void TestRoundingScientific10542() {
Expand Down Expand Up @@ -208,7 +208,7 @@ public void TestParseNegativeWithFaLocale() {
double value = parser.parse("-0,5").doubleValue();
assertEquals("Expect -0.5", -0.5, value);
} catch (ParseException e) {
TestFmwk.errln("Parsing -0.5 should have succeeded.");
errln("Parsing -0.5 should have succeeded.");
}
}

Expand All @@ -219,7 +219,7 @@ public void TestParseNegativeWithAlternativeMinusSign() {
double value = parser.parse("\u208B0.5").doubleValue();
assertEquals("Expect -0.5", -0.5, value);
} catch (ParseException e) {
TestFmwk.errln("Parsing -0.5 should have succeeded.");
errln("Parsing -0.5 should have succeeded.");
}
}

Expand Down Expand Up @@ -4625,22 +4625,22 @@ public void TestParseRequiredDecimalPoint() {
result = parser.parse(value2Parse).doubleValue();
assertEquals("wrong parsed value", parseValue, result);
} catch (ParseException e) {
TestFmwk.errln("Parsing " + value2Parse + " should have succeeded with " + testPattern[i] +
errln("Parsing " + value2Parse + " should have succeeded with " + testPattern[i] +
" and isDecimalPointMatchRequired set to: " + parser.isDecimalPatternMatchRequired());
}
try {
result = parser.parse(value2ParseWithDecimal).doubleValue();
assertEquals("wrong parsed value", parseValueWithDecimal, result);
} catch (ParseException e) {
TestFmwk.errln("Parsing " + value2ParseWithDecimal + " should have succeeded with " + testPattern[i] +
errln("Parsing " + value2ParseWithDecimal + " should have succeeded with " + testPattern[i] +
" and isDecimalPointMatchRequired set to: " + parser.isDecimalPatternMatchRequired());
}

parser.setDecimalPatternMatchRequired(true);
try {
result = parser.parse(value2Parse).doubleValue();
if(hasDecimalPoint){
TestFmwk.errln("Parsing " + value2Parse + " should NOT have succeeded with " + testPattern[i] +
errln("Parsing " + value2Parse + " should NOT have succeeded with " + testPattern[i] +
" and isDecimalPointMatchRequired set to: " + parser.isDecimalPatternMatchRequired());
}
} catch (ParseException e) {
Expand All @@ -4649,7 +4649,7 @@ public void TestParseRequiredDecimalPoint() {
try {
result = parser.parse(value2ParseWithDecimal).doubleValue();
if(!hasDecimalPoint){
TestFmwk.errln("Parsing " + value2ParseWithDecimal + " should NOT have succeeded with " + testPattern[i] +
errln("Parsing " + value2ParseWithDecimal + " should NOT have succeeded with " + testPattern[i] +
" and isDecimalPointMatchRequired set to: " + parser.isDecimalPatternMatchRequired() +
" (got: " + result + ")");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.dev.test.CoreTestFmwk;
import com.ibm.icu.impl.ICUData;
import com.ibm.icu.impl.ICUResourceBundle;
import com.ibm.icu.text.DateFormat;
Expand All @@ -56,7 +56,7 @@
import com.ibm.icu.util.VersionInfo;

@RunWith(JUnit4.class)
public class NumberRegressionTests extends TestFmwk {
public class NumberRegressionTests extends CoreTestFmwk {
private static final char EURO = '\u20ac';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.util.Arrays;

import org.junit.Test;
Expand All @@ -33,7 +34,7 @@
*
*/
@RunWith(JUnit4.class)
public class PluralRangesTest extends TestFmwk {
public class PluralRangesTest extends CoreTestFmwk {
@Test
public void TestLocaleData() {
String[][] tests = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -73,7 +74,7 @@
* @author markdavis (Mark Davis) [for fractional support]
*/
@RunWith(JUnit4.class)
public class PluralRulesTest extends TestFmwk {
public class PluralRulesTest extends CoreTestFmwk {

PluralRulesFactory factory = PluralRulesFactory.NORMAL;

Expand Down Expand Up @@ -1712,13 +1713,17 @@ public void testJavaLocaleFactory() {

@Test
public void testBug20264() {
Locale startLocale = Locale.getDefault();

String expected = "1.23400";
FixedDecimal fd = new FixedDecimal(1.234, 5, 2);
assertEquals("FixedDecimal toString", expected, fd.toString());
Locale.setDefault(Locale.FRENCH);
assertEquals("FixedDecimal toString", expected, fd.toString());
Locale.setDefault(Locale.GERMAN);
assertEquals("FixedDecimal toString", expected, fd.toString());

Locale.setDefault(startLocale);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
package com.ibm.icu.dev.test.format;

import com.ibm.icu.dev.test.CoreTestFmwk;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.Locale;
Expand All @@ -31,7 +32,7 @@
* introduces a dependency on collation. See RbnfLenientScannerTest.
*/
@RunWith(JUnit4.class)
public class RbnfTest extends TestFmwk {
public class RbnfTest extends CoreTestFmwk {
static String fracRules =
"%main:\n" +
// this rule formats the number if it's 1 or more. It formats
Expand Down
Loading

0 comments on commit 3c44e03

Please sign in to comment.