);
}
+#[test]
+fn all_targets_with_and_without() {
+ let p = project("foo")
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+ authors = []
+ "#,
+ )
+ .file("src/main.rs", "fn main() {}")
+ .build();
+ assert_that(
+ p.cargo("build").arg("-v").arg("--all-targets"),
+ execs().with_status(0)
+ // bin
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
+ --emit=dep-info,link[..]")
+ // bench
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C opt-level=3 --test [..]")
+ // unit test
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C debuginfo=2 --test [..]"),
+ );
+ assert_that(p.cargo("clean"), execs().with_status(0));
+ assert_that(
+ p.cargo("build").arg("-v"),
+ execs().with_status(0)
+ // bin
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
+ --emit=dep-info,link[..]")
+ // bench
+ .with_stderr_does_not_contain("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C opt-level=3 --test [..]")
+ // unit test
+ .with_stderr_does_not_contain("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C debuginfo=2 --test [..]"),
+ );
+}
+
#[test]
fn all_targets_no_lib() {
let p = project("foo")
}
#[test]
-fn check_all_targets() {
+fn all_targets_with_and_without() {
let foo = project("foo")
.file("Cargo.toml", SIMPLE_MANIFEST)
.file("src/main.rs", "fn main() {}")
.with_stderr_contains("[..] --crate-name test2 tests[/]test2.rs [..]")
.with_stderr_contains("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
);
+ assert_that(foo.cargo("clean"), execs().with_status(0));
+ assert_that(
+ foo.cargo("check").arg("-v"),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[..] --crate-name foo src[/]lib.rs [..]")
+ .with_stderr_contains("[..] --crate-name foo src[/]main.rs [..]")
+ .with_stderr_does_not_contain("[..] --crate-name example1 examples[/]example1.rs [..]")
+ .with_stderr_does_not_contain("[..] --crate-name test2 tests[/]test2.rs [..]")
+ .with_stderr_does_not_contain("[..] --crate-name bench3 benches[/]bench3.rs [..]"),
+ );
}
#[test]
);
}
+#[test]
+fn all_targets_with_and_without() {
+ let p = project("foo")
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+ authors = []
+ "#,
+ )
+ .file("src/main.rs", "fn main() {}")
+ .build();
+ assert_that(
+ p.cargo("rustc").arg("-v").arg("--all-targets"),
+ execs().with_status(0)
+ // bin
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
+ --emit=dep-info,link[..]")
+ // bench
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C opt-level=3 --test [..]")
+ // unit test
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C debuginfo=2 --test [..]"),
+ );
+ assert_that(p.cargo("clean"), execs().with_status(0));
+ assert_that(
+ p.cargo("rustc").arg("-v"),
+ execs().with_status(0)
+ // bin
+ .with_stderr_contains("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --crate-type bin \
+ --emit=dep-info,link[..]")
+ // bench
+ .with_stderr_does_not_contain("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C opt-level=3 --test [..]")
+ // unit test
+ .with_stderr_does_not_contain("\
+ [RUNNING] `rustc --crate-name foo src[/]main.rs --emit=dep-info,link \
+ -C debuginfo=2 --test [..]"),
+ );
+}
+
#[test]
fn fail_with_multiple_packages() {
let foo = project("foo")