Skip to content

Commit

Permalink
More.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Sep 21, 2024
1 parent 1dd25c9 commit ada3793
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/fs_additional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,27 @@ fn dotdot_even_more_in_middle_of_symlink() {
assert!(false);
}

/// Same as `dotdot_more_in_middle_of_symlink`, but use a symlink that
/// doesn't end with `..`.
#[test]
fn dotdot_even_other_in_middle_of_symlink() {
let tmpdir = tmpdir();

let foo = b"foo";
check!(tmpdir.create_dir_all("b/c"));
check!(tmpdir.write("b/target", foo));
let c = check!(tmpdir.open_dir("b/c"));
check!(symlink_dir("../../b", &c, "up"));

let path = "b/c/up/target";
let mut file = check!(tmpdir.open(path));
let mut data = Vec::new();
check!(file.read_to_end(&mut data));
assert_eq!(data, foo);

assert!(false);
}

/// Similar to `dotdot_in_middle_of_symlink`, but this time the symlink to
/// `..` does happen to be the end of the path, so we need to make sure
/// the implementation doesn't just do a stack pop when it sees the `..`
Expand Down

0 comments on commit ada3793

Please sign in to comment.