MCPcopy Create free account
hub / github.com/questdb/questdb / testListDir

Method testListDir

core/src/test/java/io/questdb/test/FilesTest.java:636–663  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 15

touchMethod · 0.95
findFirstMethod · 0.95
clearMethod · 0.95
utf8ToUtf16ZMethod · 0.95
findNameMethod · 0.95
addMethod · 0.95
toStringMethod · 0.95
findNextMethod · 0.95
findCloseMethod · 0.95
sortMethod · 0.95
toStringMethod · 0.95
getRootMethod · 0.80

Tested by

no test coverage detected