// Check on a dylib should have a different metadata hash than build.
#[test]
-fn check_dylib() {
+fn dylib_check_preserves_build_cache() {
let p = project("foo")
.file("Cargo.toml", r#"
[package]
.file("src/lib.rs", "")
.build();
- let build_output = t!(String::from_utf8(
- t!(p.cargo("build").arg("-v").exec_with_output())
- .stderr,
- ));
- let build_metadata = build_output
- .split_whitespace()
- .find(|arg| arg.starts_with("metadata="))
- .unwrap();
-
- let check_output = t!(String::from_utf8(
- t!(p.cargo("check").arg("-v").exec_with_output())
- .stderr,
- ));
- let check_metadata = check_output
- .split_whitespace()
- .find(|arg| arg.starts_with("metadata="))
- .unwrap();
-
- assert_ne!(build_metadata, check_metadata);
+ assert_that(p.cargo("build"),
+ execs().with_status(0)
+ .with_stderr("\
+[..]Compiling foo v0.1.0 ([..])
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
+
+ assert_that(p.cargo("check"),
+ execs().with_status(0));
+
+ assert_that(p.cargo("build"),
+ execs().with_status(0)
+ .with_stderr("\
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
}
// test `cargo rustc --profile check`