From 403d8260af3ae8824afcf5b87855c0eb23cf4474 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 27 Jul 2020 12:25:03 -0700 Subject: [PATCH] Update test to account for `copy`'s signature change. --- tests/fs.rs | 20 ++++++++++---------- tests/paths-containing-nul.rs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/fs.rs b/tests/fs.rs index 18d6fd6ae..4746ec67b 100644 --- a/tests/fs.rs +++ b/tests/fs.rs @@ -697,7 +697,7 @@ fn copy_file_does_not_exist() { let from = Path::new("test/nonexistent-bogus-path"); let to = Path::new("test/other-bogus-path"); - match tmpdir.copy(&from, &to) { + match tmpdir.copy(&from, &tmpdir, &to) { Ok(..) => panic!(), Err(..) => { assert!(!tmpdir.exists(from)); @@ -712,7 +712,7 @@ fn copy_src_does_not_exist() { let from = Path::new("test/nonexistent-bogus-path"); let to = "out.txt"; check!(check!(tmpdir.create(&to)).write(b"hello")); - assert!(tmpdir.copy(&from, &to).is_err()); + assert!(tmpdir.copy(&from, &tmpdir, &to).is_err()); assert!(!tmpdir.exists(from)); let mut v = Vec::new(); check!(check!(tmpdir.open(&to)).read_to_end(&mut v)); @@ -726,7 +726,7 @@ fn copy_file_ok() { let out = "out.txt"; check!(check!(tmpdir.create(&input)).write(b"hello")); - check!(tmpdir.copy(&input, &out)); + check!(tmpdir.copy(&input, &tmpdir, &out)); let mut v = Vec::new(); check!(check!(tmpdir.open(&out)).read_to_end(&mut v)); assert_eq!(v, b"hello"); @@ -743,7 +743,7 @@ fn copy_file_dst_dir() { let out = "out"; check!(tmpdir.create(&out)); - match tmpdir.copy(&*out, ".") { + match tmpdir.copy(&*out, &tmpdir, ".") { Ok(..) => panic!(), Err(..) => {} } @@ -757,7 +757,7 @@ fn copy_file_dst_exists() { check!(check!(tmpdir.create(&input)).write("foo".as_bytes())); check!(check!(tmpdir.create(&output)).write("bar".as_bytes())); - check!(tmpdir.copy(&input, &output)); + check!(tmpdir.copy(&input, &tmpdir, &output)); let mut v = Vec::new(); check!(check!(tmpdir.open(&output)).read_to_end(&mut v)); @@ -769,7 +769,7 @@ fn copy_file_src_dir() { let tmpdir = tmpdir(); let out = "out"; - match tmpdir.copy(".", &out) { + match tmpdir.copy(".", &tmpdir, &out) { Ok(..) => panic!(), Err(..) => {} } @@ -786,7 +786,7 @@ fn copy_file_preserves_perm_bits() { let mut p = attr.permissions(); p.set_readonly(true); check!(tmpdir.open(&input).and_then(|file| file.set_permissions(p))); - check!(tmpdir.copy(&input, &out)); + check!(tmpdir.copy(&input, &tmpdir, &out)); assert!(check!(tmpdir.metadata(out)).permissions().readonly()); check!(tmpdir .open(&input) @@ -801,7 +801,7 @@ fn copy_file_preserves_perm_bits() { fn copy_file_preserves_streams() { let tmp = tmpdir(); check!(check!(tmp.create("in.txt:bunny")).write("carrot".as_bytes())); - assert_eq!(check!(tmp.copy("in.txt", "out.txt")), 0); + assert_eq!(check!(tmp.copy("in.txt", &tmp, "out.txt")), 0); assert_eq!(check!(tmp.metadata("out.txt")).len(), 0); let mut v = Vec::new(); check!(check!(tmp.open("out.txt:bunny")).read_to_end(&mut v)); @@ -816,7 +816,7 @@ fn copy_file_returns_metadata_len() { check!(check!(tmp.create(&in_path)).write(b"lettuce")); #[cfg(windows)] check!(check!(tmp.create("in.txt:bunny")).write(b"carrot")); - let copied_len = check!(tmp.copy(&in_path, &out_path)); + let copied_len = check!(tmp.copy(&in_path, &tmp, &out_path)); assert_eq!(check!(tmp.metadata(out_path)).len(), copied_len); } @@ -835,7 +835,7 @@ fn copy_file_follows_dst_symlink() { check!(tmp.write(&out_path, "bar")); check!(symlink_file(&out_path, &tmp, &out_path_symlink)); - check!(tmp.copy(&in_path, &out_path_symlink)); + check!(tmp.copy(&in_path, &tmp, &out_path_symlink)); assert!(check!(tmp.symlink_metadata(out_path_symlink)) .file_type() diff --git a/tests/paths-containing-nul.rs b/tests/paths-containing-nul.rs index c229b22b0..1da720b8d 100644 --- a/tests/paths-containing-nul.rs +++ b/tests/paths-containing-nul.rs @@ -45,8 +45,8 @@ fn paths_containing_nul() { assert_invalid_input("rename1", tmpdir.rename("\0", &tmpdir, "a")); assert_invalid_input("rename2", tmpdir.rename(&dummy_file, &tmpdir, "\0")); - assert_invalid_input("copy1", tmpdir.copy("\0", "a")); - assert_invalid_input("copy2", tmpdir.copy(&dummy_file, "\0")); + assert_invalid_input("copy1", tmpdir.copy("\0", &tmpdir, "a")); + assert_invalid_input("copy2", tmpdir.copy(&dummy_file, &tmpdir, "\0")); assert_invalid_input("hard_link1", tmpdir.hard_link("\0", &tmpdir, "a")); assert_invalid_input("hard_link2", tmpdir.hard_link(&dummy_file, &tmpdir, "\0")); //fixmeassert_invalid_input("soft_link1", tmpdir.soft_link("\0", &tmpdir, "a"));