mirror of
https://github.com/rust-lang/cargo
synced 2024-09-16 06:20:49 +00:00
8cce8996be
This commit removes all distributed executables except for `cargo`. All builtin subcommands are implemented through library calls, and the fallback methods are retained to maintain extensability through new subcommands. Closes #393
34 lines
1.2 KiB
Rust
34 lines
1.2 KiB
Rust
use support::{project, execs, main_file, basic_bin_manifest, cargo_dir};
|
|
use hamcrest::{assert_that, existing_dir, is_not};
|
|
|
|
fn setup() {
|
|
}
|
|
|
|
test!(cargo_clean_simple {
|
|
let p = project("foo")
|
|
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
|
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
|
|
|
|
assert_that(p.cargo_process("build"), execs().with_status(0));
|
|
assert_that(&p.build_dir(), existing_dir());
|
|
|
|
assert_that(p.process(cargo_dir().join("cargo")).arg("clean"),
|
|
execs().with_status(0));
|
|
assert_that(&p.build_dir(), is_not(existing_dir()));
|
|
})
|
|
|
|
test!(different_dir {
|
|
let p = project("foo")
|
|
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
|
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
|
|
.file("src/bar/a.rs", "");
|
|
|
|
assert_that(p.cargo_process("build"), execs().with_status(0));
|
|
assert_that(&p.build_dir(), existing_dir());
|
|
|
|
assert_that(p.process(cargo_dir().join("cargo")).arg("clean")
|
|
.cwd(p.root().join("src")),
|
|
execs().with_status(0).with_stdout(""));
|
|
assert_that(&p.build_dir(), is_not(existing_dir()));
|
|
})
|