On Fri, 2 Feb 2024 01:54:12 GMT, Archie Cobbs <aco...@openjdk.org> wrote:

>> test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java line 
>> 70:
>> 
>>> 68:     @BeforeAll
>>> 69:     public static void setup() {
>>> 70:         savedLocale = Locale.getDefault();
>> 
>> I'm not sure we need to save the default locale and restore it, unless I'm 
>> missing something.
>
> We are verifying output that includes floating point numbers, and the current 
> locale affects that:
> 
> jshell> Locale.setDefault(Locale.US);
> 
> jshell> new MessageFormat("{0}").format(new Object[] { 1.23 });
> $9 ==> "1.23"
> 
> jshell> Locale.setDefault(Locale.FRENCH);
> 
> jshell> new MessageFormat("{0}").format(new Object[] { 1.23 });
> $11 ==> "1,23"

Right, that makes sense.

>> test/jdk/java/text/Format/MessageFormat/MessageFormatToPatternTest.java line 
>> 104:
>> 
>>> 102:             Arguments.of("{0,choice,0.0#option A: {0}|1.0#option B: 
>>> {0}'}'}", "option B: 1.23}"),
>>> 103:             Arguments.of("{0,choice,0.0#option A: {0}|2.0#option B: 
>>> {0}'}'}", "option A: 1.23"),
>>> 104: 
>> 
>> Suggestion:
>> 
>> // Absurd double quote examples
>> Arguments.of("Foo '}''''''''}' {0,number,bar'}' '}' } baz ", "Foo }''''} 
>> bar} } 1 baz "),
>> Arguments.of("'''}''{'''}''''}'"), "'}'{'}''}"),
>
> Thanks, should be fixed.

Thanks for correcting the suggested test case, second argument had the extra 
`)` on accident.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17416#discussion_r1476525565
PR Review Comment: https://git.openjdk.org/jdk/pull/17416#discussion_r1476524867

Reply via email to