]> granicus.if.org Git - icu/commitdiff
ICU-20186 Adding test for leading and trailing spaces in DecimalFormat.
authorShane Carr <shane@unicode.org>
Tue, 27 Nov 2018 01:01:32 +0000 (17:01 -0800)
committerShane F. Carr <shane@unicode.org>
Wed, 5 Dec 2018 23:37:38 +0000 (15:37 -0800)
icu4c/source/test/intltest/numfmtst.cpp
icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatTest.java

index 6f008441c94e957d1a6726f1a54a8de38fd5399c..52ed34d91057d97aef13fcd2c593c56ccd9bec0a 100644 (file)
@@ -411,6 +411,10 @@ void NumberFormatTest::Test20186_SpacesAroundSemicolon() {
     df = DecimalFormat(u"0.00;0.00", {"en-us", status}, status);
     expect2(df, 1, u"1.00");
     expect(df, -1, u"1.00");  // parses as 1, not -1
+
+    df = DecimalFormat(u" 0.00 ; -0.00 ", {"en-us", status}, status);
+    expect2(df, 1, u" 1.00 ");
+    expect2(df, -1, u" -1.00 ");
 }
 
 /*
index 8033e27a839f78cf3ddcfe9a317045e855240589..dce8d327b4d8f702c8774d2b20eb296c6dc7ce54 100644 (file)
@@ -270,6 +270,10 @@ public class NumberFormatTest extends TestFmwk {
         df = new DecimalFormat("0.00;0.00");
         expect2(df, 1, "1.00");
         expect(df, -1, "1.00");  // parses as 1, not -1
+
+        df = new DecimalFormat(" 0.00 ; -0.00 ");
+        expect2(df, 1, " 1.00 ");
+        expect2(df, -1, " -1.00 ");
     }
 
     // Test exponential pattern