auto merge of #10282 : sfackler/rust/rustpkg-test-cfg, r=alexcrichton
Closes #10238
This commit is contained in:
commit
379bda9e52
@ -252,8 +252,8 @@ pub fn flags_forbidden_for_cmd(flags: &RustcFlags,
|
||||
return true;
|
||||
}
|
||||
|
||||
if !cfgs.is_empty() && cmd != "build" && cmd != "install" {
|
||||
println("The --cfg option can only be used with the build or install commands.");
|
||||
if !cfgs.is_empty() && cmd != "build" && cmd != "install" && cmd != "test" {
|
||||
println("The --cfg option can only be used with the build, test, or install commands.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2098,6 +2098,19 @@ fn test_rustpkg_test_failure_exit_status() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rustpkg_test_cfg() {
|
||||
let foo_id = PkgId::new("foo");
|
||||
let foo_workspace = create_local_package(&foo_id);
|
||||
let foo_workspace = foo_workspace.path();
|
||||
writeFile(&foo_workspace.join_many(["src", "foo-0.1", "test.rs"]),
|
||||
"#[test] #[cfg(not(foobar))] fn f() { assert!('a' != 'a'); }");
|
||||
let output = command_line_test([~"test", ~"--cfg", ~"foobar", ~"foo"],
|
||||
foo_workspace);
|
||||
let output_str = str::from_utf8(output.output);
|
||||
assert!(output_str.contains("0 passed; 0 failed; 0 ignored; 0 measured"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_rebuild_when_needed() {
|
||||
let foo_id = PkgId::new("foo");
|
||||
|
Loading…
x
Reference in New Issue
Block a user