()
| 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 { |
nothing calls this directly
no test coverage detected