cargo/tests/testsuite/version.rs

44 lines
922 B
Rust
Raw Normal View History

2019-11-25 02:42:45 +00:00
//! Tests for displaying the cargo version.
2019-09-12 19:52:46 +00:00
use cargo_test_support::project;
2014-07-17 20:00:58 +00:00
#[cargo_test]
fn simple() {
let p = project().build();
2014-07-17 20:00:58 +00:00
p.cargo("version")
.with_stdout(&format!("{}\n", cargo::version()))
.run();
2018-03-14 15:17:44 +00:00
p.cargo("--version")
.with_stdout(&format!("{}\n", cargo::version()))
.run();
}
#[cargo_test]
2016-10-10 22:15:08 +00:00
#[cfg_attr(target_os = "windows", ignore)]
2016-07-15 17:14:34 +00:00
fn version_works_without_rustc() {
let p = project().build();
p.cargo("version").env("PATH", "").run();
}
#[cargo_test]
fn version_works_with_bad_config() {
let p = project().file(".cargo/config", "this is not toml").build();
p.cargo("version").run();
}
#[cargo_test]
fn version_works_with_bad_target_dir() {
let p = project()
2018-03-14 15:17:44 +00:00
.file(
".cargo/config",
r#"
[build]
target-dir = 4
2018-03-14 15:17:44 +00:00
"#,
2018-12-08 11:19:47 +00:00
)
.build();
p.cargo("version").run();
}