]> git.proxmox.com Git - cargo.git/blame - tests/testsuite/version.rs
Re-enable version_works_without_rustc on windows.
[cargo.git] / tests / testsuite / version.rs
CommitLineData
83571aee
EH
1//! Tests for displaying the cargo version.
2
c5318a17 3use cargo_test_support::{cargo_process, project};
fc982531 4
0e0d9688 5#[cargo_test]
6950bbb0 6fn simple() {
7fe2fbc8 7 let p = project().build();
fc982531 8
85984a87 9 p.cargo("version")
fdc398e7 10 .with_stdout(&format!("cargo {}\n", cargo::version()))
85984a87 11 .run();
1e682848 12
85984a87 13 p.cargo("--version")
fdc398e7 14 .with_stdout(&format!("cargo {}\n", cargo::version()))
85984a87 15 .run();
6950bbb0 16}
13171985 17
0e0d9688 18#[cargo_test]
885e7ea1 19fn version_works_without_rustc() {
7fe2fbc8 20 let p = project().build();
85984a87 21 p.cargo("version").env("PATH", "").run();
67367a65 22}
a3ae2996 23
0e0d9688 24#[cargo_test]
a3ae2996 25fn version_works_with_bad_config() {
85984a87
DW
26 let p = project().file(".cargo/config", "this is not toml").build();
27 p.cargo("version").run();
a3ae2996
AK
28}
29
0e0d9688 30#[cargo_test]
a3ae2996 31fn version_works_with_bad_target_dir() {
7fe2fbc8 32 let p = project()
1e682848
AC
33 .file(
34 ".cargo/config",
35 r#"
6f8c7d5a
EH
36 [build]
37 target-dir = 4
38 "#,
fecb7246
AC
39 )
40 .build();
85984a87 41 p.cargo("version").run();
a3ae2996 42}
c5318a17
EH
43
44#[cargo_test]
45fn verbose() {
46 // This is mainly to check that it doesn't explode.
47 cargo_process("-vV")
48 .with_stdout_contains(&format!("cargo {}", cargo::version()))
49 .with_stdout_contains("host: [..]")
50 .with_stdout_contains("libgit2: [..]")
51 .with_stdout_contains("libcurl: [..]")
5a8be7ba 52 .with_stdout_contains("os: [..]")
c5318a17
EH
53 .run();
54}