Fixes #11066 - URIUtilTest.testFileUriGetUriLastPathSegment on macOS

We special-cased this test on macOS to support NFD form normalization.

That may no longer be necessary, and therefore the test currently fails.

Run the default expectations, and, in case of failure on macOS, test
against the old workaround.
This commit is contained in:
Christian Kohlschütter 2023-12-14 22:25:29 +01:00
parent 2812023db3
commit 665f61a3e7
1 changed files with 16 additions and 4 deletions

View File

@ -810,12 +810,24 @@ public class URIUtilTest
FS.touch(base);
}
URI uri = base.toUri();
if (OS.MAC.isCurrentOs())
try
{
// Normalize Unicode to NFD form that OSX Path/FileSystem produces
expectedName = Normalizer.normalize(expectedName, Normalizer.Form.NFD);
assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
}
catch (AssertionError e)
{
if (OS.MAC.isCurrentOs())
{
// Normalize Unicode to NFD form that OSX Path/FileSystem produces
expectedName = Normalizer.normalize(expectedName, Normalizer.Form.NFD);
assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
}
else
{
throw e;
}
}
assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
}
public static Stream<Arguments> uriLastSegmentSource() throws IOException