| ... | @@ -1435,14 +1435,17 @@ test "setEndPos" { | ... | @@ -1435,14 +1435,17 @@ test "setEndPos" { |
| 1435 | try testing.expectEqual(0, try f.preadAll(&buffer, 0)); | 1435 | try testing.expectEqual(0, try f.preadAll(&buffer, 0)); |
| 1436 | | 1436 | |
| 1437 | // Invalid file length should error gracefully. Actual limit is host | 1437 | // Invalid file length should error gracefully. Actual limit is host |
| 1438 | // and file-system dependent, but 1PB should fail most everywhere. | 1438 | // and file-system dependent, but 1PB should fail on filesystems like |
| 1439 | // Except MacOS APFS limit is 8 exabytes. | 1439 | // EXT4 and NTFS. But XFS or Btrfs support up to 8EiB files. |
| 1440 | f.setEndPos(0x4_0000_0000_0000) catch |err| if (err != error.FileTooBig) { | 1440 | f.setEndPos(0x4_0000_0000_0000) catch |err| if (err != error.FileTooBig) { |
| 1441 | return err; | 1441 | return err; |
| 1442 | }; | 1442 | }; |
| 1443 | | 1443 | |
| 1444 | try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63))); // Maximum signed value | 1444 | f.setEndPos(std.math.maxInt(u63)) catch |err| if (err != error.FileTooBig) { |
| | 1445 | return err; |
| | 1446 | }; |
| 1445 | | 1447 | |
| | 1448 | try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u63) + 1)); |
| 1446 | try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u64))); | 1449 | try testing.expectError(error.FileTooBig, f.setEndPos(std.math.maxInt(u64))); |
| 1447 | } | 1450 | } |
| 1448 | | 1451 | |