| ... | @@ -298,6 +298,28 @@ test "File.stat on a File that is a symlink returns Kind.sym_link" { | ... | @@ -298,6 +298,28 @@ test "File.stat on a File that is a symlink returns Kind.sym_link" { |
| 298 | }.impl); | 298 | }.impl); |
| 299 | } | 299 | } |
| 300 | | 300 | |
| | 301 | test "Dir.statFile on a symlink" { |
| | 302 | const io = testing.io; |
| | 303 | |
| | 304 | try testWithAllSupportedPathTypes(struct { |
| | 305 | fn impl(ctx: *TestContext) !void { |
| | 306 | const dir_target_path = try ctx.transformPath("test_file"); |
| | 307 | try ctx.dir.writeFile(io, .{ |
| | 308 | .sub_path = dir_target_path, |
| | 309 | .data = "Some test content", |
| | 310 | }); |
| | 311 | |
| | 312 | try setupSymlink(io, ctx.dir, dir_target_path, "symlink", .{}); |
| | 313 | |
| | 314 | const file_stat = try ctx.dir.statFile(io, "test_file", .{ .follow_symlinks = false }); |
| | 315 | try testing.expectEqual(File.Kind.file, file_stat.kind); |
| | 316 | |
| | 317 | const link_stat = try ctx.dir.statFile(io, "symlink", .{ .follow_symlinks = false }); |
| | 318 | try testing.expectEqual(File.Kind.sym_link, link_stat.kind); |
| | 319 | } |
| | 320 | }.impl); |
| | 321 | } |
| | 322 | |
| 301 | test "openDir" { | 323 | test "openDir" { |
| 302 | const io = testing.io; | 324 | const io = testing.io; |
| 303 | | 325 | |