mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

* Collapse the nested cargotest::support module into the cargotest module (merge the mod.rs's) * Rename the cargotest module to support * Nest the top-level hamcrest module into support
58 lines
1.5 KiB
Rust
58 lines
1.5 KiB
Rust
use support::{basic_bin_manifest, execs, main_file, project};
|
|
use support::hamcrest::assert_that;
|
|
|
|
fn verify_project_success_output() -> String {
|
|
r#"{"success":"true"}"#.into()
|
|
}
|
|
|
|
#[test]
|
|
fn cargo_verify_project_path_to_cargo_toml_relative() {
|
|
let p = project()
|
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
|
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
|
.build();
|
|
|
|
assert_that(
|
|
p.cargo("verify-project")
|
|
.arg("--manifest-path")
|
|
.arg("foo/Cargo.toml")
|
|
.cwd(p.root().parent().unwrap()),
|
|
execs()
|
|
.with_status(0)
|
|
.with_stdout(verify_project_success_output()),
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn cargo_verify_project_path_to_cargo_toml_absolute() {
|
|
let p = project()
|
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
|
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
|
.build();
|
|
|
|
assert_that(
|
|
p.cargo("verify-project")
|
|
.arg("--manifest-path")
|
|
.arg(p.root().join("Cargo.toml"))
|
|
.cwd(p.root().parent().unwrap()),
|
|
execs()
|
|
.with_status(0)
|
|
.with_stdout(verify_project_success_output()),
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn cargo_verify_project_cwd() {
|
|
let p = project()
|
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
|
.file("src/foo.rs", &main_file(r#""i am foo""#, &[]))
|
|
.build();
|
|
|
|
assert_that(
|
|
p.cargo("verify-project").cwd(p.root()),
|
|
execs()
|
|
.with_status(0)
|
|
.with_stdout(verify_project_success_output()),
|
|
);
|
|
}
|