cargo/tests/testsuite/version.rs
Dale Wijnand 43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00

52 lines
1.1 KiB
Rust

use cargo;
use support::{execs, project};
use support::hamcrest::assert_that;
#[test]
fn simple() {
let p = project().build();
assert_that(
p.cargo("version"),
execs()
.with_status(0)
.with_stdout(&format!("{}\n", cargo::version())),
);
assert_that(
p.cargo("--version"),
execs()
.with_status(0)
.with_stdout(&format!("{}\n", cargo::version())),
);
}
#[test]
#[cfg_attr(target_os = "windows", ignore)]
fn version_works_without_rustc() {
let p = project().build();
assert_that(p.cargo("version").env("PATH", ""), execs().with_status(0));
}
#[test]
fn version_works_with_bad_config() {
let p = project()
.file(".cargo/config", "this is not toml")
.build();
assert_that(p.cargo("version"), execs().with_status(0));
}
#[test]
fn version_works_with_bad_target_dir() {
let p = project()
.file(
".cargo/config",
r#"
[build]
target-dir = 4
"#,
)
.build();
assert_that(p.cargo("version"), execs().with_status(0));
}