Skip to content

Commit 069fbbc

Browse files
committed
mutants: Test local list_dir skips symlinks
1 parent 64614f2 commit 069fbbc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/transport/local.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020-2023 Martin Pool.
1+
// Copyright 2020-2025 Martin Pool.
22

33
// This program is free software; you can redistribute it and/or modify
44
// it under the terms of the GNU General Public License as published by
@@ -294,6 +294,20 @@ mod test {
294294

295295
temp.close().unwrap();
296296
}
297+
298+
#[cfg(unix)]
299+
#[test]
300+
fn list_dir_skips_symlinks() {
301+
// Archives aren't expected to contain symlinks and so list_dir just skips them.
302+
303+
let transport = Transport::temp();
304+
let dir = transport.local_path().unwrap();
305+
std::os::unix::fs::symlink("foo", dir.join("alink")).unwrap();
306+
307+
let list_dir = transport.list_dir(".").unwrap();
308+
assert_eq!(list_dir.files, [""; 0]);
309+
assert_eq!(list_dir.dirs, [""; 0]);
310+
}
297311

298312
#[test]
299313
fn write_file() {

0 commit comments

Comments
 (0)