MCPcopy Index your code
hub / github.com/questdb/questdb / testTruncate

Method testTruncate

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

Source from the content-addressed store, hash-verified

1337 }
1338
1339 @Test
1340 public void testTruncate() throws Exception {
1341 assertMemoryLeak(() -> {
1342 File temp = temporaryFolder.newFile();
1343 TestUtils.writeStringToFile(temp, "abcde");
1344 try (Path path = new Path().of(temp.getAbsolutePath())) {
1345 Assert.assertTrue(Files.exists(path.$()));
1346 Assert.assertEquals(5, Files.length(path.$()));
1347
1348 long fd = Files.openRW(path.$());
1349 try {
1350 Files.truncate(fd, 3);
1351 Assert.assertEquals(3, Files.length(path.$()));
1352 Files.truncate(fd, 0);
1353 Assert.assertEquals(0, Files.length(path.$()));
1354 } finally {
1355 Files.close(fd);
1356 }
1357 }
1358 });
1359 }
1360
1361 @Test
1362 public void testTypeOfDirAndSoftLinkAreTheSame() throws Exception {

Callers

nothing calls this directly

Calls 11

writeStringToFileMethod · 0.95
existsMethod · 0.95
lengthMethod · 0.95
openRWMethod · 0.95
truncateMethod · 0.95
closeMethod · 0.95
ofMethod · 0.65
$Method · 0.65
assertMemoryLeakMethod · 0.45
assertTrueMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected