diff --git a/tests/fs_additional.rs b/tests/fs_additional.rs index 5f234542..ad2e9016 100644 --- a/tests/fs_additional.rs +++ b/tests/fs_additional.rs @@ -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 `..`