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
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2016-05-25 20:55:42 +00:00
|
|
|
fn simple() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project().build();
|
2014-07-17 20:00:58 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("version")
|
|
|
|
.with_stdout(&format!("{}\n", cargo::version()))
|
|
|
|
.run();
|
2018-03-14 15:17:44 +00:00
|
|
|
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("--version")
|
|
|
|
.with_stdout(&format!("{}\n", cargo::version()))
|
|
|
|
.run();
|
2016-05-25 20:55:42 +00:00
|
|
|
}
|
2016-01-31 16:02:47 +00:00
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[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() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project().build();
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("version").env("PATH", "").run();
|
2016-07-15 17:33:57 +00:00
|
|
|
}
|
2016-07-24 07:45:02 +00:00
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2016-07-24 07:45:02 +00:00
|
|
|
fn version_works_with_bad_config() {
|
2018-08-28 09:20:03 +00:00
|
|
|
let p = project().file(".cargo/config", "this is not toml").build();
|
|
|
|
p.cargo("version").run();
|
2016-07-24 07:45:02 +00:00
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2016-07-24 07:45:02 +00:00
|
|
|
fn version_works_with_bad_target_dir() {
|
2018-07-20 11:47:47 +00:00
|
|
|
let p = project()
|
2018-03-14 15:17:44 +00:00
|
|
|
.file(
|
|
|
|
".cargo/config",
|
|
|
|
r#"
|
2016-07-24 07:45:02 +00:00
|
|
|
[build]
|
|
|
|
target-dir = 4
|
2018-03-14 15:17:44 +00:00
|
|
|
"#,
|
2018-12-08 11:19:47 +00:00
|
|
|
)
|
|
|
|
.build();
|
2018-08-28 09:20:03 +00:00
|
|
|
p.cargo("version").run();
|
2016-07-24 07:45:02 +00:00
|
|
|
}
|