Skip to content

Commit

Permalink
Add a test for closed issue #111
Browse files Browse the repository at this point in the history
This was fixed when rustc properly added extra-filename to all temp outputs as
opposed to just libraries.

Closes #111
  • Loading branch information
alexcrichton committed Jul 22, 2014
1 parent e944687 commit cd13dc2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/test_cargo_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,48 @@ test!(cargo_test_twice {
execs().with_status(0));
}
})

test!(lib_bin_same_name {
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.0.1"
authors = []
[[lib]]
name = "foo"
[[bin]]
name = "foo"
"#)
.file("src/lib.rs", "
#[test] fn lib_test() {}
")
.file("src/main.rs", "
extern crate foo;
#[test]
fn bin_test() {}
");

let output = p.cargo_process("cargo-test")
.exec_with_output().assert();
let out = str::from_utf8(output.output.as_slice()).assert();

let bin = "\
running 1 test
test bin_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured";
let lib = "\
running 1 test
test lib_test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured";

let head = format!("{compiling} foo v0.0.1 (file:{dir})",
compiling = COMPILING, dir = p.root().display());

assert!(out == format!("{}\n\n{}\n\n\n{}\n\n", head, bin, lib).as_slice() ||
out == format!("{}\n\n{}\n\n\n{}\n\n", head, lib, bin).as_slice());
})

5 comments on commit cd13dc2

@bors
Copy link
Contributor

@bors bors commented on cd13dc2 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from wycats
at alexcrichton@cd13dc2

@bors
Copy link
Contributor

@bors bors commented on cd13dc2 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/cargo/issue-111 = cd13dc2 merged ok, testing candidate = b220240

@bors
Copy link
Contributor

@bors bors commented on cd13dc2 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/cargo/issue-111 = cd13dc2 into auto-cargo

@bors
Copy link
Contributor

@bors bors commented on cd13dc2 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on cd13dc2 Jul 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto-cargo = b220240

Please sign in to comment.