| ... | ... | @@ -298,6 +298,43 @@ test "File.stat on a File that is a symlink returns Kind.sym_link" { |
| 298 | 298 | }.impl); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | test "File.stat on a File that is a named pipe returns Kind.named_pipe" { |
| 302 | // Creating pipes is Io.Threaded-specific |
| 303 | var threaded: std.Io.Threaded = .init(std.testing.allocator, .{ |
| 304 | .argv0 = .empty, |
| 305 | .environ = .empty, |
| 306 | }); |
| 307 | defer threaded.deinit(); |
| 308 | const io = threaded.io(); |
| 309 | |
| 310 | var read_end: Io.File = undefined; |
| 311 | var write_end: Io.File = undefined; |
| 312 | switch (builtin.target.os.tag) { |
| 313 | .wasi => return error.SkipZigTest, |
| 314 | .windows => { |
| 315 | const pipe = try threaded.windowsCreatePipe(.{ |
| 316 | .server = .{ .mode = .{ .IO = .SYNCHRONOUS_NONALERT } }, |
| 317 | .client = .{ .mode = .{ .IO = .SYNCHRONOUS_NONALERT } }, |
| 318 | .inbound = true, |
| 319 | }); |
| 320 | read_end = .{ .handle = pipe[0], .flags = .{ .nonblocking = false } }; |
| 321 | write_end = .{ .handle = pipe[1], .flags = .{ .nonblocking = false } }; |
| 322 | }, |
| 323 | else => { |
| 324 | const pipe = try std.Io.Threaded.pipe2(.{ .CLOEXEC = true }); |
| 325 | read_end = .{ .handle = pipe[0], .flags = .{ .nonblocking = false } }; |
| 326 | write_end = .{ .handle = pipe[1], .flags = .{ .nonblocking = false } }; |
| 327 | }, |
| 328 | } |
| 329 | defer { |
| 330 | read_end.close(io); |
| 331 | write_end.close(io); |
| 332 | } |
| 333 | |
| 334 | try expectEqual(.named_pipe, (try read_end.stat(io)).kind); |
| 335 | try expectEqual(.named_pipe, (try write_end.stat(io)).kind); |
| 336 | } |
| 337 | |
| 301 | 338 | test "Dir.statFile on a symlink" { |
| 302 | 339 | const io = testing.io; |
| 303 | 340 | |