Skip to content

Commit

Permalink
classlib: fix toLowerCase/toUpperCase on Locale.ROOT (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev authored Nov 19, 2023
1 parent fa5fa3d commit 4fc43a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public String toString() {

public TString toLanguageTag() {
StringBuilder result = new StringBuilder();
result.append(languageCode);
result.append(languageCode.isEmpty() ? "und" : languageCode);
if (!countryCode.isEmpty()) {
result.append('-');
result.append(countryCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public void convertsCaseLocaled() {
assertEquals("İSTANBUL", turkish.toUpperCase(new Locale("tr", "TR")));
assertNotEquals(common.toUpperCase(Locale.US), turkish.toUpperCase(new Locale("tr", "TR")));
assertEquals(common.toUpperCase(Locale.US), common.toUpperCase(Locale.CANADA));
assertEquals(common.toUpperCase(Locale.US), common.toUpperCase(Locale.ROOT));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ public void testLanguageTag() {
assertEquals("zh-CN", Locale.SIMPLIFIED_CHINESE.toLanguageTag());
assertEquals("en-GB", Locale.UK.toLanguageTag());
assertEquals("en-US", Locale.US.toLanguageTag());
assertEquals("und", Locale.ROOT.toLanguageTag());
}
}

0 comments on commit 4fc43a5

Please sign in to comment.