mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 11:12:25 +00:00
Add integration tests
This commit is contained in:
parent
78018d3602
commit
e34b36aeab
|
@ -96,6 +96,34 @@ test!(invalid_characters {
|
|||
.with_stderr("Invalid character `.` in crate name: `foo.rs`"));
|
||||
});
|
||||
|
||||
test!(rust_prefix_stripped {
|
||||
assert_that(cargo_process("new").arg("rust-foo"),
|
||||
execs().with_status(0)
|
||||
.with_stdout("Note: package will be named `foo`; use --name to override"));
|
||||
let toml = paths::root().join("rust-foo/Cargo.toml");
|
||||
let mut contents = String::new();
|
||||
File::open(&toml).unwrap().read_to_string(&mut contents).unwrap();
|
||||
assert!(contents.contains(r#"name = "foo""#));
|
||||
});
|
||||
|
||||
test!(bin_disables_stripping {
|
||||
assert_that(cargo_process("new").arg("rust-foo").arg("--bin"),
|
||||
execs().with_status(0));
|
||||
let toml = paths::root().join("rust-foo/Cargo.toml");
|
||||
let mut contents = String::new();
|
||||
File::open(&toml).unwrap().read_to_string(&mut contents).unwrap();
|
||||
assert!(contents.contains(r#"name = "rust-foo""#));
|
||||
});
|
||||
|
||||
test!(explicit_name_not_stripped {
|
||||
assert_that(cargo_process("new").arg("foo").arg("--name").arg("rust-bar"),
|
||||
execs().with_status(0));
|
||||
let toml = paths::root().join("foo/Cargo.toml");
|
||||
let mut contents = String::new();
|
||||
File::open(&toml).unwrap().read_to_string(&mut contents).unwrap();
|
||||
assert!(contents.contains(r#"name = "rust-bar""#));
|
||||
});
|
||||
|
||||
test!(finds_author_user {
|
||||
// Use a temp dir to make sure we don't pick up .cargo/config somewhere in
|
||||
// the hierarchy
|
||||
|
|
Loading…
Reference in a new issue