@@ -276,16 +276,17 @@ test "realpathat" {
276
276
var buf2 : [fs .MAX_PATH_BYTES ]u8 = undefined ;
277
277
const cwd_realpathat = try os .realpathat (cwd .fd , "" , & buf2 );
278
278
testing .expect (mem .eql (u8 , cwd_path , cwd_realpathat ));
279
- const cwd_realpathat2 = try os .realpathat (cwd .fd , "." , & buf2 ); // shouldn't change a thing
280
- testing .expect (mem .eql (u8 , cwd_path , cwd_realpathat2 ));
281
279
282
280
// Now, open an actual Dir{"."} since on Unix `realpathat` behaves
283
281
// in a special way when `fd` equals `cwd.fd`
284
- const dir = try cwd .openDir ("." , .{});
285
- const cwd_realpathat3 = try os .realpathat (dir .fd , "" , & buf2 );
286
- testing .expect (mem .eql (u8 , cwd_path , cwd_realpathat3 ));
287
- const cwd_realpathat4 = try os .realpathat (dir .fd , "." , & buf2 ); // shouldn't change a thing
288
- testing .expect (mem .eql (u8 , cwd_path , cwd_realpathat4 ));
282
+ var dir = try cwd .openDir ("." , .{});
283
+ defer dir .close ();
284
+
285
+ const cwd_realpathat2 = try os .realpathat (dir .fd , "" , & buf2 );
286
+ testing .expect (mem .eql (u8 , cwd_path , cwd_realpathat2 ));
287
+
288
+ // Finally, try getting a path for something that doesn't exist
289
+ testing .expectError (error .FileNotFound , os .realpathat (dir .fd , "definitely_bogus_does_not_exist1234" , & buf2 ));
289
290
}
290
291
291
292
test "sigaltstack" {
0 commit comments