Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up inferred* tests #4654

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 8 additions & 30 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3676,7 +3676,7 @@ Caused by:


#[test]
fn dirs_in_bin_dir_with_main_rs() {
fn inferred_bins() {
let p = project("foo")
.file("Cargo.toml", r#"
[package]
Expand All @@ -3686,21 +3686,17 @@ fn dirs_in_bin_dir_with_main_rs() {
"#)
.file("src/main.rs", "fn main() {}")
.file("src/bin/bar.rs", "fn main() {}")
.file("src/bin/bar2.rs", "fn main() {}")
.file("src/bin/bar3/main.rs", "fn main() {}")
.file("src/bin/bar4/main.rs", "fn main() {}")
.file("src/bin/baz/main.rs", "fn main() {}")
.build();

assert_that(p.cargo("build"), execs().with_status(0));
assert_that(&p.bin("foo"), existing_file());
assert_that(&p.bin("bar"), existing_file());
assert_that(&p.bin("bar2"), existing_file());
assert_that(&p.bin("bar3"), existing_file());
assert_that(&p.bin("bar4"), existing_file());
assert_that(&p.bin("baz"), existing_file());
}

#[test]
fn dir_and_file_with_same_name_in_bin() {
fn inferred_bins_duplicate_name() {
// this should fail, because we have two binaries with the same name
let p = project("bar")
.file("Cargo.toml", r#"
Expand All @@ -3722,7 +3718,7 @@ fn dir_and_file_with_same_name_in_bin() {
}

#[test]
fn inferred_path_in_src_bin_foo() {
fn inferred_bin_path() {
let p = project("foo")
.file("Cargo.toml", r#"
[package]
Expand Down Expand Up @@ -3780,7 +3776,7 @@ fn inferred_tests() {
}

#[test]
fn inferred_benchmark() {
fn inferred_benchmarks() {
let p = project("foo")
.file("Cargo.toml", r#"
[package]
Expand All @@ -3790,29 +3786,11 @@ fn inferred_benchmark() {
"#)
.file("src/lib.rs", "fn main() {}")
.file("benches/bar.rs", "fn main() {}")
.file("benches/baz/main.rs", "fn main() {}")
.build();

assert_that(
p.cargo("bench").arg("--bench=bar"),
execs().with_status(0));
}

#[test]
fn inferred_benchmark_from_directory() {
//FIXME: merge with `inferred_benchmark` after fixing #4504
let p = project("foo")
.file("Cargo.toml", r#"
[package]
name = "foo"
version = "0.1.0"
authors = []
"#)
.file("src/lib.rs", "fn main() {}")
.file("benches/bar/main.rs", "fn main() {}")
.build();

assert_that(
p.cargo("bench").arg("--bench=bar"),
p.cargo("bench").arg("--bench=bar").arg("--bench=baz"),
execs().with_status(0));
}

Expand Down