Skip to content

Commit

Permalink
Add a test for stable metadata across workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerwhall authored and Lexmark-tyhall committed Jun 25, 2017
1 parent dd02aa3 commit eb0e4c0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate cargo;
#[macro_use]
extern crate cargotest;
extern crate hamcrest;
extern crate tempdir;
Expand Down Expand Up @@ -3271,3 +3272,32 @@ fn no_bin_in_src_with_lib() {
execs().with_status(101)
.with_stderr_contains(r#"[ERROR] couldn't read "[..]main.rs"[..]"#));
}

#[test]
fn same_metadata_different_directory() {
// A top-level crate built in two different workspaces should have the
// same metadata hash.
let p = project("foo1")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]));
let output = t!(String::from_utf8(
t!(p.cargo_process("build").arg("-v").exec_with_output())
.stderr,
));
let metadata = output
.split_whitespace()
.filter(|arg| arg.starts_with("metadata="))
.next()
.unwrap();

let p = project("foo2")
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]));

assert_that(
p.cargo_process("build").arg("-v"),
execs().with_status(0).with_stderr_contains(
format!("[..]{}[..]", metadata),
),
);
}

0 comments on commit eb0e4c0

Please sign in to comment.