File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 99
1010package org .elasticsearch .entitlement .runtime .policy ;
1111
12+ import org .elasticsearch .core .PathUtils ;
1213import org .elasticsearch .test .ESTestCase ;
1314
1415import static org .elasticsearch .entitlement .runtime .policy .FileUtils .PATH_ORDER ;
@@ -78,4 +79,14 @@ public void testPathOrderWindows() {
7879 assertThat (PATH_ORDER .compare ("C:\\ a\\ b" , "C:\\ a\\ b\\ foo.txt" ), lessThan (0 ));
7980 assertThat (PATH_ORDER .compare ("C:\\ a\\ c" , "C:\\ a\\ b.txt" ), greaterThan (0 ));
8081 }
82+
83+ public void testPathOrderingSpecialCharacters () {
84+ assertThat (PATH_ORDER .compare ("aa\uD801 \uDC28 " , "aa\uD801 \uDC28 " ), is (0 ));
85+ assertThat (PATH_ORDER .compare ("aa\uD801 \uDC28 " , "aa\uD801 \uDC28 a" ), lessThan (0 ));
86+
87+ var s = PathUtils .getDefaultFileSystem ().getSeparator ();
88+ // Similarly to the other tests, we assert that Directories come BEFORE files, even when names are special characters
89+ assertThat (PATH_ORDER .compare (s + "\uD801 \uDC28 " + s + "b" , s + "\uD801 \uDC28 .xml" ), lessThan (0 ));
90+ assertThat (PATH_ORDER .compare (s + "\uD801 \uDC28 " + s + "b" , s + "b.xml" ), greaterThan (0 ));
91+ }
8192}
You can’t perform that action at this time.
0 commit comments