]> git.proxmox.com Git - cargo.git/blob - tests/testsuite/version.rs
Re-enable version_works_without_rustc on windows.
[cargo.git] / tests / testsuite / version.rs
1 //! Tests for displaying the cargo version.
2
3 use cargo_test_support::{cargo_process, project};
4
5 #[cargo_test]
6 fn simple() {
7 let p = project().build();
8
9 p.cargo("version")
10 .with_stdout(&format!("cargo {}\n", cargo::version()))
11 .run();
12
13 p.cargo("--version")
14 .with_stdout(&format!("cargo {}\n", cargo::version()))
15 .run();
16 }
17
18 #[cargo_test]
19 fn version_works_without_rustc() {
20 let p = project().build();
21 p.cargo("version").env("PATH", "").run();
22 }
23
24 #[cargo_test]
25 fn version_works_with_bad_config() {
26 let p = project().file(".cargo/config", "this is not toml").build();
27 p.cargo("version").run();
28 }
29
30 #[cargo_test]
31 fn version_works_with_bad_target_dir() {
32 let p = project()
33 .file(
34 ".cargo/config",
35 r#"
36 [build]
37 target-dir = 4
38 "#,
39 )
40 .build();
41 p.cargo("version").run();
42 }
43
44 #[cargo_test]
45 fn 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: [..]")
52 .with_stdout_contains("os: [..]")
53 .run();
54 }