Add cargo --no-verify test when checking that src dir was not modified while publishing
authorGabriel Féron <feron.gabriel@gmail.com>
Mon, 28 May 2018 11:59:35 +0000 (13:59 +0200)
committerGabriel Féron <feron.gabriel@gmail.com>
Mon, 28 May 2018 11:59:40 +0000 (13:59 +0200)
tests/testsuite/package.rs
tests/testsuite/publish.rs

index 235a91f3d3dff93e1dc823f618f1b3645d61c317..08aad2f035931734d1954ba811c92678f6793dc2 100644 (file)
@@ -1416,3 +1416,38 @@ fn lock_file_and_workspace() {
         fname.ends_with("Cargo.lock")
     }));
 }
+
+#[test]
+fn do_not_package_if_src_was_modified() {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.0.1"
+            authors = []
+        "#)
+        .file("src/main.rs", r#"
+            fn main() { println!("hello"); }
+        "#)
+        .file("build.rs", r#"
+            use std::fs::File;
+            use std::io::Write;
+
+            fn main() {
+                let mut file = File::create("src/generated.txt").expect("failed to create file");
+                file.write_all(b"Hello, world of generated files.").expect("failed to write");
+            }
+        "#)
+        .build();
+
+    assert_that(
+        p.cargo("package"),
+        execs().with_status(101),
+    );
+
+    assert_that(
+        p.cargo("package")
+        .arg("--no-verify"),
+        execs().with_status(0),
+    );
+}
index ac7e5c7e47e219c4d1eb1b4f6f39cbe34b65aca5..0eba5a8ddac881906a4820cdc53322649fbacea5 100644 (file)
@@ -872,36 +872,3 @@ fn block_publish_no_registry() {
         ),
     );
 }
-
-#[test]
-fn do_not_publish_if_src_was_modified() {
-    publish::setup();
-
-    let p = project("foo")
-        .file("Cargo.toml", r#"
-            [project]
-            name = "foo"
-            version = "0.0.1"
-            authors = []
-        "#)
-        .file("src/main.rs", r#"
-            fn main() { println!("hello"); }
-        "#)
-        .file("build.rs", r#"
-            use std::fs::File;
-            use std::io::Write;
-
-            fn main() {
-                let mut file = File::create("src/generated.txt").expect("failed to create file");
-                file.write_all(b"Hello, world of generated files.").expect("failed to write");
-            }
-        "#)
-        .build();
-
-    assert_that(
-        p.cargo("publish")
-            .arg("--index")
-            .arg(publish::registry().to_string()),
-        execs().with_status(101),
-    );
-}
\ No newline at end of file