]> git.lizzy.rs Git - rust.git/commitdiff
rustpkg: Add a test that `rustpkg install` doesn't copy a non-changed file
authorTim Chevalier <chevalier@alum.wellesley.edu>
Fri, 8 Nov 2013 23:42:20 +0000 (15:42 -0800)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Sat, 9 Nov 2013 00:03:18 +0000 (16:03 -0800)
This bug was already fixed, just needed a test.

Closes #9569

src/librustpkg/tests.rs

index b45e4ff1755f4e9319a5439b16080e283b000751..4460d1701b54a3dbe9aee78bcbf05b0d9743ff5a 100644 (file)
@@ -1096,6 +1096,24 @@ fn no_rebuilding() {
     }
 }
 
+#[test]
+fn no_recopying() {
+    let p_id = PkgId::new("foo");
+    let workspace = create_local_package(&p_id);
+    let workspace = workspace.path();
+    command_line_test([~"install", ~"foo"], workspace);
+    let foo_lib = installed_library_in_workspace(&p_id.path, workspace);
+    assert!(foo_lib.is_some());
+    // Now make `foo` read-only so that subsequent attempts to copy to it will fail
+    assert!(chmod_read_only(&foo_lib.unwrap()));
+
+    match command_line_test_partial([~"install", ~"foo"], workspace) {
+        Success(*) => (), // ok
+        Fail(65) => fail!("no_recopying failed: it tried to re-copy foo"),
+        Fail(_) => fail!("no_copying failed for some other reason")
+    }
+}
+
 #[test]
 fn no_rebuilding_dep() {
     let p_id = PkgId::new("foo");