-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
version.rs
50 lines (41 loc) · 1.27 KB
/
version.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
extern crate cargo;
extern crate cargotest;
extern crate hamcrest;
extern crate rustc_serialize;
use cargotest::support::{project, execs};
use hamcrest::assert_that;
#[test]
fn simple() {
let p = project("foo");
p.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("foo");
assert_that(p.cargo_process("version").env("PATH", ""),
execs().with_status(0));
}
#[test]
fn version_works_with_bad_config() {
let p = project("foo")
.file(".cargo/config", "this is not toml");
assert_that(p.cargo_process("version"),
execs().with_status(0));
}
#[test]
fn version_works_with_bad_target_dir() {
let p = project("foo")
.file(".cargo/config", r#"
[build]
target-dir = 4
"#);
assert_that(p.cargo_process("version"),
execs().with_status(0));
}