()
| 634 | } |
| 635 | |
| 636 | @Test |
| 637 | public void testListDir() throws Exception { |
| 638 | assertMemoryLeak(() -> { |
| 639 | String temp = temporaryFolder.getRoot().getAbsolutePath(); |
| 640 | ObjList<String> names = new ObjList<>(); |
| 641 | try (Path path = new Path().of(temp)) { |
| 642 | try (Path cp = new Path()) { |
| 643 | Assert.assertTrue(Files.touch(cp.of(temp).concat("a.txt").$())); |
| 644 | StringSink nameSink = new StringSink(); |
| 645 | long pFind = Files.findFirst(path.$()); |
| 646 | Assert.assertTrue(pFind != 0); |
| 647 | try { |
| 648 | do { |
| 649 | nameSink.clear(); |
| 650 | Utf8s.utf8ToUtf16Z(Files.findName(pFind), nameSink); |
| 651 | names.add(nameSink.toString()); |
| 652 | } while (Files.findNext(pFind) > 0); |
| 653 | } finally { |
| 654 | Files.findClose(pFind); |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | names.sort(Chars::compare); |
| 660 | |
| 661 | Assert.assertEquals("[.,..,a.txt]", names.toString()); |
| 662 | }); |
| 663 | } |
| 664 | |
| 665 | @Test |
| 666 | public void testListNonExistingDir() throws Exception { |
nothing calls this directly
no test coverage detected