mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Remove hamcrest existing_file()
This commit is contained in:
parent
6fd1b54c65
commit
570fe8927d
@ -1,4 +1,3 @@
|
|||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::is_nightly;
|
use support::is_nightly;
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
use support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
use support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, project};
|
||||||
@ -33,7 +32,7 @@ fn cargo_bench_simple() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
||||||
|
|
||||||
@ -302,7 +301,7 @@ fn cargo_bench_failing_test() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ use std::fs::{self, File};
|
|||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use cargo::util::paths::dylib_path_envvar;
|
use cargo::util::paths::dylib_path_envvar;
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::paths::{root, CargoPathExt};
|
use support::paths::{root, CargoPathExt};
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::ProjectBuilder;
|
use support::ProjectBuilder;
|
||||||
@ -20,7 +19,7 @@ fn cargo_compile_simple() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
||||||
}
|
}
|
||||||
@ -144,7 +143,7 @@ fn cargo_compile_manifest_path() {
|
|||||||
p.cargo("build --manifest-path foo/Cargo.toml")
|
p.cargo("build --manifest-path foo/Cargo.toml")
|
||||||
.cwd(p.root().parent().unwrap())
|
.cwd(p.root().parent().unwrap())
|
||||||
.run();
|
.run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -445,7 +444,7 @@ fn cargo_compile_with_invalid_code() {
|
|||||||
|
|
||||||
To learn more, run the command again with --verbose.\n",
|
To learn more, run the command again with --verbose.\n",
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -527,7 +526,7 @@ fn cargo_compile_with_warnings_in_a_dep_package() {
|
|||||||
.with_stderr_contains("[..]function is never used: `dead`[..]")
|
.with_stderr_contains("[..]function is never used: `dead`[..]")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
}
|
}
|
||||||
@ -584,9 +583,9 @@ fn cargo_compile_with_nested_deps_inferred() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("libbar.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbar.rlib").is_file());
|
||||||
assert_that(&p.bin("libbaz.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbaz.rlib").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
}
|
}
|
||||||
@ -643,9 +642,9 @@ fn cargo_compile_with_nested_deps_correct_bin() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("libbar.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbar.rlib").is_file());
|
||||||
assert_that(&p.bin("libbaz.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbaz.rlib").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
}
|
}
|
||||||
@ -703,9 +702,9 @@ fn cargo_compile_with_nested_deps_shorthand() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("libbar.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbar.rlib").is_file());
|
||||||
assert_that(&p.bin("libbaz.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbaz.rlib").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
}
|
}
|
||||||
@ -769,9 +768,9 @@ fn cargo_compile_with_nested_deps_longhand() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("libbar.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbar.rlib").is_file());
|
||||||
assert_that(&p.bin("libbaz.rlib"), is_not(existing_file()));
|
assert!(!p.bin("libbaz.rlib").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
}
|
}
|
||||||
@ -1503,9 +1502,9 @@ fn many_crate_types_old_style_lib_location() {
|
|||||||
please rename the file to `src/lib.rs` or set lib.path in Cargo.toml",
|
please rename the file to `src/lib.rs` or set lib.path in Cargo.toml",
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
let fname = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
let fname = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
||||||
assert_that(&p.root().join("target/debug").join(&fname), existing_file());
|
assert!(p.root().join("target/debug").join(&fname).is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1529,9 +1528,9 @@ fn many_crate_types_correct() {
|
|||||||
.build();
|
.build();
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
let fname = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
let fname = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
||||||
assert_that(&p.root().join("target/debug").join(&fname), existing_file());
|
assert!(p.root().join("target/debug").join(&fname).is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1579,7 +1578,7 @@ fn ignore_broken_symlinks() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
||||||
}
|
}
|
||||||
@ -2356,7 +2355,7 @@ fn cargo_platform_specific_dependency() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
p.cargo("test").run();
|
p.cargo("test").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2409,7 +2408,7 @@ fn cargo_platform_specific_dependency_wrong_platform() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
p.process(&p.bin("foo")).run();
|
p.process(&p.bin("foo")).run();
|
||||||
|
|
||||||
let loc = p.root().join("Cargo.lock");
|
let loc = p.root().join("Cargo.lock");
|
||||||
@ -2441,7 +2440,7 @@ fn example_as_lib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(&p.example_lib("ex", "lib"), existing_file());
|
assert!(p.example_lib("ex", "lib").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2464,7 +2463,7 @@ fn example_as_rlib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(&p.example_lib("ex", "rlib"), existing_file());
|
assert!(p.example_lib("ex", "rlib").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2487,7 +2486,7 @@ fn example_as_dylib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(&p.example_lib("ex", "dylib"), existing_file());
|
assert!(p.example_lib("ex", "dylib").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2514,7 +2513,7 @@ fn example_as_proc_macro() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(&p.example_lib("ex", "proc-macro"), existing_file());
|
assert!(p.example_lib("ex", "proc-macro").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2526,15 +2525,15 @@ fn example_bin_same_name() {
|
|||||||
|
|
||||||
p.cargo("test --no-run -v").run();
|
p.cargo("test --no-run -v").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), is_not(existing_file()));
|
assert!(!p.bin("foo").is_file());
|
||||||
// We expect a file of the form bin/foo-{metadata_hash}
|
// We expect a file of the form bin/foo-{metadata_hash}
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
|
|
||||||
p.cargo("test --no-run -v").run();
|
p.cargo("test --no-run -v").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), is_not(existing_file()));
|
assert!(!p.bin("foo").is_file());
|
||||||
// We expect a file of the form bin/foo-{metadata_hash}
|
// We expect a file of the form bin/foo-{metadata_hash}
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2542,7 +2541,7 @@ fn compile_then_delete() {
|
|||||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
let p = project().file("src/main.rs", "fn main() {}").build();
|
||||||
|
|
||||||
p.cargo("run -v").run();
|
p.cargo("run -v").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
// On windows unlinking immediately after running often fails, so sleep
|
// On windows unlinking immediately after running often fails, so sleep
|
||||||
sleep_ms(100);
|
sleep_ms(100);
|
||||||
@ -2645,12 +2644,9 @@ fn predictable_filenames() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v").run();
|
p.cargo("build -v").run();
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX);
|
||||||
assert_that(
|
assert!(p.root().join("target/debug").join(dylib_name).is_file());
|
||||||
&p.root().join("target/debug").join(dylib_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2662,7 +2658,7 @@ fn dashes_to_underscores() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v").run();
|
p.cargo("build -v").run();
|
||||||
assert_that(&p.bin("foo-bar"), existing_file());
|
assert!(p.bin("foo-bar").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2701,7 +2697,7 @@ Caused by:
|
|||||||
[..]
|
[..]
|
||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.bin("a"), is_not(existing_file()));
|
assert!(!p.bin("a").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2715,13 +2711,13 @@ fn filtering() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --lib").run();
|
p.cargo("build --lib").run();
|
||||||
assert_that(&p.bin("a"), is_not(existing_file()));
|
assert!(!p.bin("a").is_file());
|
||||||
|
|
||||||
p.cargo("build --bin=a --example=a").run();
|
p.cargo("build --bin=a --example=a").run();
|
||||||
assert_that(&p.bin("a"), existing_file());
|
assert!(p.bin("a").is_file());
|
||||||
assert_that(&p.bin("b"), is_not(existing_file()));
|
assert!(!p.bin("b").is_file());
|
||||||
assert_that(&p.bin("examples/a"), existing_file());
|
assert!(p.bin("examples/a").is_file());
|
||||||
assert_that(&p.bin("examples/b"), is_not(existing_file()));
|
assert!(!p.bin("examples/b").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2735,10 +2731,10 @@ fn filtering_implicit_bins() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --bins").run();
|
p.cargo("build --bins").run();
|
||||||
assert_that(&p.bin("a"), existing_file());
|
assert!(p.bin("a").is_file());
|
||||||
assert_that(&p.bin("b"), existing_file());
|
assert!(p.bin("b").is_file());
|
||||||
assert_that(&p.bin("examples/a"), is_not(existing_file()));
|
assert!(!p.bin("examples/a").is_file());
|
||||||
assert_that(&p.bin("examples/b"), is_not(existing_file()));
|
assert!(!p.bin("examples/b").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2752,10 +2748,10 @@ fn filtering_implicit_examples() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --examples").run();
|
p.cargo("build --examples").run();
|
||||||
assert_that(&p.bin("a"), is_not(existing_file()));
|
assert!(!p.bin("a").is_file());
|
||||||
assert_that(&p.bin("b"), is_not(existing_file()));
|
assert!(!p.bin("b").is_file());
|
||||||
assert_that(&p.bin("examples/a"), existing_file());
|
assert!(p.bin("examples/a").is_file());
|
||||||
assert_that(&p.bin("examples/b"), existing_file());
|
assert!(p.bin("examples/b").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2794,24 +2790,12 @@ fn custom_target_dir_env() {
|
|||||||
let exe_name = format!("foo{}", env::consts::EXE_SUFFIX);
|
let exe_name = format!("foo{}", env::consts::EXE_SUFFIX);
|
||||||
|
|
||||||
p.cargo("build").env("CARGO_TARGET_DIR", "foo/target").run();
|
p.cargo("build").env("CARGO_TARGET_DIR", "foo/target").run();
|
||||||
assert_that(
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
assert!(!p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
assert!(p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::create_dir(p.root().join(".cargo")).unwrap();
|
fs::create_dir(p.root().join(".cargo")).unwrap();
|
||||||
File::create(p.root().join(".cargo/config"))
|
File::create(p.root().join(".cargo/config"))
|
||||||
@ -2823,18 +2807,9 @@ fn custom_target_dir_env() {
|
|||||||
"#,
|
"#,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
p.cargo("build").env("CARGO_TARGET_DIR", "bar/target").run();
|
p.cargo("build").env("CARGO_TARGET_DIR", "bar/target").run();
|
||||||
assert_that(
|
assert!(p.root().join("bar/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("bar/target/debug").join(&exe_name),
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
assert!(p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2844,24 +2819,12 @@ fn custom_target_dir_line_parameter() {
|
|||||||
let exe_name = format!("foo{}", env::consts::EXE_SUFFIX);
|
let exe_name = format!("foo{}", env::consts::EXE_SUFFIX);
|
||||||
|
|
||||||
p.cargo("build --target-dir foo/target").run();
|
p.cargo("build --target-dir foo/target").run();
|
||||||
assert_that(
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
assert!(!p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
assert!(p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
|
|
||||||
fs::create_dir(p.root().join(".cargo")).unwrap();
|
fs::create_dir(p.root().join(".cargo")).unwrap();
|
||||||
File::create(p.root().join(".cargo/config"))
|
File::create(p.root().join(".cargo/config"))
|
||||||
@ -2873,38 +2836,22 @@ fn custom_target_dir_line_parameter() {
|
|||||||
"#,
|
"#,
|
||||||
).unwrap();
|
).unwrap();
|
||||||
p.cargo("build --target-dir bar/target").run();
|
p.cargo("build --target-dir bar/target").run();
|
||||||
assert_that(
|
assert!(p.root().join("bar/target/debug").join(&exe_name).is_file());
|
||||||
&p.root().join("bar/target/debug").join(&exe_name),
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
existing_file(),
|
assert!(p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.cargo("build --target-dir foobar/target")
|
p.cargo("build --target-dir foobar/target")
|
||||||
.env("CARGO_TARGET_DIR", "bar/target")
|
.env("CARGO_TARGET_DIR", "bar/target")
|
||||||
.run();
|
.run();
|
||||||
assert_that(
|
assert!(
|
||||||
&p.root().join("foobar/target/debug").join(&exe_name),
|
p.root()
|
||||||
existing_file(),
|
.join("foobar/target/debug")
|
||||||
);
|
.join(&exe_name)
|
||||||
assert_that(
|
.is_file()
|
||||||
&p.root().join("bar/target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("foo/target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(&exe_name),
|
|
||||||
existing_file(),
|
|
||||||
);
|
);
|
||||||
|
assert!(p.root().join("bar/target/debug").join(&exe_name).is_file());
|
||||||
|
assert!(p.root().join("foo/target/debug").join(&exe_name).is_file());
|
||||||
|
assert!(p.root().join("target/debug").join(&exe_name).is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -2947,7 +2894,7 @@ fn build_multiple_packages() {
|
|||||||
|
|
||||||
p.cargo("build -p d1 -p d2 -p foo").run();
|
p.cargo("build -p d1 -p d2 -p foo").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
p.process(&p.bin("foo")).with_stdout("i am foo\n").run();
|
||||||
|
|
||||||
let d1_path = &p
|
let d1_path = &p
|
||||||
@ -2959,10 +2906,10 @@ fn build_multiple_packages() {
|
|||||||
.join("debug")
|
.join("debug")
|
||||||
.join(format!("d2{}", env::consts::EXE_SUFFIX));
|
.join(format!("d2{}", env::consts::EXE_SUFFIX));
|
||||||
|
|
||||||
assert_that(d1_path, existing_file());
|
assert!(d1_path.is_file());
|
||||||
p.process(d1_path).with_stdout("d1").run();
|
p.process(d1_path).with_stdout("d1").run();
|
||||||
|
|
||||||
assert_that(d2_path, existing_file());
|
assert!(d2_path.is_file());
|
||||||
p.process(d2_path).with_stdout("d2").run();
|
p.process(d2_path).with_stdout("d2").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3468,14 +3415,14 @@ fn build_all_workspace_implicit_examples() {
|
|||||||
[..] Compiling foo v0.1.0 ([..])\n\
|
[..] Compiling foo v0.1.0 ([..])\n\
|
||||||
[..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n",
|
[..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n",
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.bin("a"), is_not(existing_file()));
|
assert!(!p.bin("a").is_file());
|
||||||
assert_that(&p.bin("b"), is_not(existing_file()));
|
assert!(!p.bin("b").is_file());
|
||||||
assert_that(&p.bin("examples/c"), existing_file());
|
assert!(p.bin("examples/c").is_file());
|
||||||
assert_that(&p.bin("examples/d"), existing_file());
|
assert!(p.bin("examples/d").is_file());
|
||||||
assert_that(&p.bin("e"), is_not(existing_file()));
|
assert!(!p.bin("e").is_file());
|
||||||
assert_that(&p.bin("f"), is_not(existing_file()));
|
assert!(!p.bin("f").is_file());
|
||||||
assert_that(&p.bin("examples/g"), existing_file());
|
assert!(p.bin("examples/g").is_file());
|
||||||
assert_that(&p.bin("examples/h"), existing_file());
|
assert!(p.bin("examples/h").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -3586,14 +3533,14 @@ fn build_all_virtual_manifest_implicit_examples() {
|
|||||||
[..] Compiling [..] v0.1.0 ([..])\n\
|
[..] Compiling [..] v0.1.0 ([..])\n\
|
||||||
[..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n",
|
[..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n",
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.bin("a"), is_not(existing_file()));
|
assert!(!p.bin("a").is_file());
|
||||||
assert_that(&p.bin("b"), is_not(existing_file()));
|
assert!(!p.bin("b").is_file());
|
||||||
assert_that(&p.bin("examples/c"), existing_file());
|
assert!(p.bin("examples/c").is_file());
|
||||||
assert_that(&p.bin("examples/d"), existing_file());
|
assert!(p.bin("examples/d").is_file());
|
||||||
assert_that(&p.bin("e"), is_not(existing_file()));
|
assert!(!p.bin("e").is_file());
|
||||||
assert_that(&p.bin("f"), is_not(existing_file()));
|
assert!(!p.bin("f").is_file());
|
||||||
assert_that(&p.bin("examples/g"), existing_file());
|
assert!(p.bin("examples/g").is_file());
|
||||||
assert_that(&p.bin("examples/h"), existing_file());
|
assert!(p.bin("examples/h").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -3773,10 +3720,7 @@ fn cdylib_not_lifted() {
|
|||||||
|
|
||||||
for file in files {
|
for file in files {
|
||||||
println!("checking: {}", file);
|
println!("checking: {}", file);
|
||||||
assert_that(
|
assert!(p.root().join("target/debug/deps").join(&file).is_file());
|
||||||
&p.root().join("target/debug/deps").join(&file),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3809,7 +3753,7 @@ fn cdylib_final_outputs() {
|
|||||||
|
|
||||||
for file in files {
|
for file in files {
|
||||||
println!("checking: {}", file);
|
println!("checking: {}", file);
|
||||||
assert_that(&p.root().join("target/debug").join(&file), existing_file());
|
assert!(p.root().join("target/debug").join(&file).is_file());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3915,9 +3859,9 @@ fn inferred_bins() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), existing_file());
|
assert!(p.bin("baz").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -3954,7 +3898,7 @@ fn inferred_bin_path() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -3966,8 +3910,8 @@ fn inferred_examples() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("test").run();
|
p.cargo("test").run();
|
||||||
assert_that(&p.bin("examples/bar"), existing_file());
|
assert!(p.bin("examples/bar").is_file());
|
||||||
assert_that(&p.bin("examples/baz"), existing_file());
|
assert!(p.bin("examples/baz").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -4190,10 +4134,10 @@ fn uplift_pdb_of_bin_on_windows() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --bins --examples --tests").run();
|
p.cargo("build --bins --examples --tests").run();
|
||||||
assert_that(&p.target_debug_dir().join("foo.pdb"), existing_file());
|
assert!(p.target_debug_dir().join("foo.pdb").is_file());
|
||||||
assert_that(&p.target_debug_dir().join("b.pdb"), existing_file());
|
assert!(p.target_debug_dir().join("b.pdb").is_file());
|
||||||
assert_that(&p.target_debug_dir().join("c.pdb"), is_not(existing_file()));
|
assert!(!p.target_debug_dir().join("c.pdb").is_file());
|
||||||
assert_that(&p.target_debug_dir().join("d.pdb"), is_not(existing_file()));
|
assert!(!p.target_debug_dir().join("d.pdb").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that `cargo build` chooses the correct profile for building
|
// Make sure that `cargo build` chooses the correct profile for building
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::{basic_bin_manifest, basic_manifest, main_file, project};
|
use support::{basic_bin_manifest, basic_manifest, main_file, project};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -34,7 +33,7 @@ fn cargo_build_plan_simple() {
|
|||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.bin("foo"), is_not(existing_file()));
|
assert!(!p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -6,7 +6,6 @@ use std::thread;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use cargo::util::paths::remove_dir_all;
|
use cargo::util::paths::remove_dir_all;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_manifest, cross_compile, project};
|
use support::{basic_manifest, cross_compile, project};
|
||||||
@ -1722,14 +1721,8 @@ fn cfg_doc() {
|
|||||||
.build();
|
.build();
|
||||||
p.cargo("doc").run();
|
p.cargo("doc").run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(
|
assert!(p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||||
&p.root().join("target/doc/foo/fn.foo.html"),
|
assert!(p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/doc/bar/fn.bar.html"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1841,14 +1834,8 @@ fn cfg_override_doc() {
|
|||||||
.build();
|
.build();
|
||||||
p.cargo("doc").run();
|
p.cargo("doc").run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(
|
assert!(p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||||
&p.root().join("target/doc/foo/fn.foo.html"),
|
assert!(p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/doc/bar/fn.bar.html"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -6,7 +6,6 @@ use std::str;
|
|||||||
|
|
||||||
use cargo;
|
use cargo;
|
||||||
use support::cargo_process;
|
use support::cargo_process;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::paths::{self, CargoPathExt};
|
use support::paths::{self, CargoPathExt};
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_bin_manifest, basic_manifest, cargo_exe, project, Project};
|
use support::{basic_bin_manifest, basic_manifest, cargo_exe, project, Project};
|
||||||
@ -227,7 +226,7 @@ fn cargo_subcommand_env() {
|
|||||||
let target_dir = p.target_debug_dir();
|
let target_dir = p.target_debug_dir();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("cargo-envtest"), existing_file());
|
assert!(p.bin("cargo-envtest").is_file());
|
||||||
|
|
||||||
let cargo = cargo_exe().canonicalize().unwrap();
|
let cargo = cargo_exe().canonicalize().unwrap();
|
||||||
let mut path = path();
|
let mut path = path();
|
||||||
@ -257,7 +256,7 @@ fn cargo_subcommand_args() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
let cargo_foo_bin = p.bin("cargo-foo");
|
let cargo_foo_bin = p.bin("cargo-foo");
|
||||||
assert_that(&cargo_foo_bin, existing_file());
|
assert!(cargo_foo_bin.is_file());
|
||||||
|
|
||||||
let mut path = path();
|
let mut path = path();
|
||||||
path.push(p.target_debug_dir());
|
path.push(p.target_debug_dir());
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use glob::glob;
|
use glob::glob;
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::install::exe;
|
use support::install::exe;
|
||||||
use support::is_nightly;
|
use support::is_nightly;
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
@ -573,27 +572,15 @@ fn check_artifacts() {
|
|||||||
.file("benches/b1.rs", "")
|
.file("benches/b1.rs", "")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check").run();
|
p.cargo("check").run();
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
assert!(!p.root().join("target/debug").join(exe("foo")).is_file());
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(exe("foo")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.root().join("target").rm_rf();
|
p.root().join("target").rm_rf();
|
||||||
p.cargo("check --lib").run();
|
p.cargo("check --lib").run();
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
assert!(!p.root().join("target/debug").join(exe("foo")).is_file());
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(exe("foo")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.root().join("target").rm_rf();
|
p.root().join("target").rm_rf();
|
||||||
p.cargo("check --bin foo").run();
|
p.cargo("check --bin foo").run();
|
||||||
@ -601,31 +588,16 @@ fn check_artifacts() {
|
|||||||
// The nightly check can be removed once 1.27 is stable.
|
// The nightly check can be removed once 1.27 is stable.
|
||||||
// Bins now generate `rmeta` files.
|
// Bins now generate `rmeta` files.
|
||||||
// See: https://github.com/rust-lang/rust/pull/49289
|
// See: https://github.com/rust-lang/rust/pull/49289
|
||||||
assert_that(&p.root().join("target/debug/libfoo.rmeta"), existing_file());
|
assert!(p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
}
|
}
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
assert!(!p.root().join("target/debug").join(exe("foo")).is_file());
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(exe("foo")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.root().join("target").rm_rf();
|
p.root().join("target").rm_rf();
|
||||||
p.cargo("check --test t1").run();
|
p.cargo("check --test t1").run();
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rmeta"),
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
is_not(existing_file()),
|
assert!(!p.root().join("target/debug").join(exe("foo")).is_file());
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(exe("foo")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
glob(&p.root().join("target/debug/t1-*").to_str().unwrap())
|
glob(&p.root().join("target/debug/t1-*").to_str().unwrap())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -635,33 +607,20 @@ fn check_artifacts() {
|
|||||||
|
|
||||||
p.root().join("target").rm_rf();
|
p.root().join("target").rm_rf();
|
||||||
p.cargo("check --example ex1").run();
|
p.cargo("check --example ex1").run();
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rmeta"),
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
is_not(existing_file()),
|
assert!(
|
||||||
);
|
!p.root()
|
||||||
assert_that(
|
.join("target/debug/examples")
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
.join(exe("ex1"))
|
||||||
is_not(existing_file()),
|
.is_file()
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug/examples").join(exe("ex1")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
p.root().join("target").rm_rf();
|
p.root().join("target").rm_rf();
|
||||||
p.cargo("check --bench b1").run();
|
p.cargo("check --bench b1").run();
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rmeta").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rmeta"),
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
is_not(existing_file()),
|
assert!(!p.root().join("target/debug").join(exe("foo")).is_file());
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/debug").join(exe("foo")),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
glob(&p.root().join("target/debug/b1-*").to_str().unwrap())
|
glob(&p.root().join("target/debug/b1-*").to_str().unwrap())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_bin_manifest, basic_manifest, git, main_file, project};
|
use support::{basic_bin_manifest, basic_manifest, git, main_file, project};
|
||||||
|
|
||||||
@ -73,17 +72,17 @@ fn clean_multiple_packages() {
|
|||||||
.join("debug")
|
.join("debug")
|
||||||
.join(format!("d2{}", env::consts::EXE_SUFFIX));
|
.join(format!("d2{}", env::consts::EXE_SUFFIX));
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(d1_path, existing_file());
|
assert!(d1_path.is_file());
|
||||||
assert_that(d2_path, existing_file());
|
assert!(d2_path.is_file());
|
||||||
|
|
||||||
p.cargo("clean -p d1 -p d2")
|
p.cargo("clean -p d1 -p d2")
|
||||||
.cwd(&p.root().join("src"))
|
.cwd(&p.root().join("src"))
|
||||||
.with_stdout("")
|
.with_stdout("")
|
||||||
.run();
|
.run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(d1_path, is_not(existing_file()));
|
assert!(!d1_path.is_file());
|
||||||
assert_that(d2_path, is_not(existing_file()));
|
assert!(!d2_path.is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -10,7 +10,7 @@ use std::{env, str};
|
|||||||
use git2;
|
use git2;
|
||||||
use support::cargo_process;
|
use support::cargo_process;
|
||||||
use support::git;
|
use support::git;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
use support::hamcrest::assert_that;
|
||||||
use support::install::{cargo_home, has_installed_exe};
|
use support::install::{cargo_home, has_installed_exe};
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_manifest, execs, project};
|
use support::{basic_manifest, execs, project};
|
||||||
@ -172,17 +172,17 @@ fn multiple_registry_fetches() {
|
|||||||
execs().run_output(&b);
|
execs().run_output(&b);
|
||||||
|
|
||||||
let suffix = env::consts::EXE_SUFFIX;
|
let suffix = env::consts::EXE_SUFFIX;
|
||||||
assert_that(
|
assert!(
|
||||||
&p.root()
|
p.root()
|
||||||
.join("a/target/debug")
|
.join("a/target/debug")
|
||||||
.join(format!("foo{}", suffix)),
|
.join(format!("foo{}", suffix))
|
||||||
existing_file(),
|
.is_file()
|
||||||
);
|
);
|
||||||
assert_that(
|
assert!(
|
||||||
&p.root()
|
p.root()
|
||||||
.join("b/target/debug")
|
.join("b/target/debug")
|
||||||
.join(format!("bar{}", suffix)),
|
.join(format!("bar{}", suffix))
|
||||||
existing_file(),
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::{basic_bin_manifest, basic_manifest, cross_compile, project};
|
use support::{basic_bin_manifest, basic_manifest, cross_compile, project};
|
||||||
use support::{is_nightly, rustc_host};
|
use support::{is_nightly, rustc_host};
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ fn simple_cross() {
|
|||||||
|
|
||||||
let target = cross_compile::alternate();
|
let target = cross_compile::alternate();
|
||||||
p.cargo("build -v --target").arg(&target).run();
|
p.cargo("build -v --target").arg(&target).run();
|
||||||
assert_that(&p.target_bin(&target, "foo"), existing_file());
|
assert!(p.target_bin(&target, "foo").is_file());
|
||||||
|
|
||||||
p.process(&p.target_bin(&target, "foo")).run();
|
p.process(&p.target_bin(&target, "foo")).run();
|
||||||
}
|
}
|
||||||
@ -98,7 +97,7 @@ fn simple_cross_config() {
|
|||||||
|
|
||||||
let target = cross_compile::alternate();
|
let target = cross_compile::alternate();
|
||||||
p.cargo("build -v").run();
|
p.cargo("build -v").run();
|
||||||
assert_that(&p.target_bin(&target, "foo"), existing_file());
|
assert!(p.target_bin(&target, "foo").is_file());
|
||||||
|
|
||||||
p.process(&p.target_bin(&target, "foo")).run();
|
p.process(&p.target_bin(&target, "foo")).run();
|
||||||
}
|
}
|
||||||
@ -131,7 +130,7 @@ fn simple_deps() {
|
|||||||
|
|
||||||
let target = cross_compile::alternate();
|
let target = cross_compile::alternate();
|
||||||
p.cargo("build --target").arg(&target).run();
|
p.cargo("build --target").arg(&target).run();
|
||||||
assert_that(&p.target_bin(&target, "foo"), existing_file());
|
assert!(p.target_bin(&target, "foo").is_file());
|
||||||
|
|
||||||
p.process(&p.target_bin(&target, "foo")).run();
|
p.process(&p.target_bin(&target, "foo")).run();
|
||||||
}
|
}
|
||||||
@ -219,7 +218,7 @@ fn plugin_deps() {
|
|||||||
|
|
||||||
let target = cross_compile::alternate();
|
let target = cross_compile::alternate();
|
||||||
foo.cargo("build --target").arg(&target).run();
|
foo.cargo("build --target").arg(&target).run();
|
||||||
assert_that(&foo.target_bin(&target, "foo"), existing_file());
|
assert!(foo.target_bin(&target, "foo").is_file());
|
||||||
|
|
||||||
foo.process(&foo.target_bin(&target, "foo")).run();
|
foo.process(&foo.target_bin(&target, "foo")).run();
|
||||||
}
|
}
|
||||||
@ -316,7 +315,7 @@ fn plugin_to_the_max() {
|
|||||||
foo.cargo("build -v --target").arg(&target).run();
|
foo.cargo("build -v --target").arg(&target).run();
|
||||||
println!("second");
|
println!("second");
|
||||||
foo.cargo("build -v --target").arg(&target).run();
|
foo.cargo("build -v --target").arg(&target).run();
|
||||||
assert_that(&foo.target_bin(&target, "foo"), existing_file());
|
assert!(foo.target_bin(&target, "foo").is_file());
|
||||||
|
|
||||||
foo.process(&foo.target_bin(&target, "foo")).run();
|
foo.process(&foo.target_bin(&target, "foo")).run();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::{basic_bin_manifest, main_file, project};
|
use support::{basic_bin_manifest, main_file, project};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -13,7 +12,7 @@ fn build_dep_info() {
|
|||||||
|
|
||||||
let depinfo_bin_path = &p.bin("foo").with_extension("d");
|
let depinfo_bin_path = &p.bin("foo").with_extension("d");
|
||||||
|
|
||||||
assert_that(depinfo_bin_path, existing_file());
|
assert!(depinfo_bin_path.is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -37,10 +36,7 @@ fn build_dep_info_lib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(
|
assert!(p.example_lib("ex", "lib").with_extension("d").is_file());
|
||||||
&p.example_lib("ex", "lib").with_extension("d"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -63,10 +59,7 @@ fn build_dep_info_rlib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(
|
assert!(p.example_lib("ex", "rlib").with_extension("d").is_file());
|
||||||
&p.example_lib("ex", "rlib").with_extension("d"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -89,10 +82,7 @@ fn build_dep_info_dylib() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=ex").run();
|
p.cargo("build --example=ex").run();
|
||||||
assert_that(
|
assert!(p.example_lib("ex", "dylib").with_extension("d").is_file());
|
||||||
&p.example_lib("ex", "dylib").with_extension("d"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -4,7 +4,6 @@ use std::str;
|
|||||||
use support;
|
use support;
|
||||||
|
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_lib_manifest, basic_manifest, git, path2url, project};
|
use support::{basic_lib_manifest, basic_manifest, git, path2url, project};
|
||||||
@ -36,7 +35,7 @@ fn simple() {
|
|||||||
dir = path2url(p.root())
|
dir = path2url(p.root())
|
||||||
)).run();
|
)).run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -107,8 +106,8 @@ fn doc_deps() {
|
|||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
|
assert!(p.root().join("target/doc/bar/index.html").is_file());
|
||||||
|
|
||||||
// Verify that it only emits rmeta for the dependency.
|
// Verify that it only emits rmeta for the dependency.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -134,8 +133,8 @@ fn doc_deps() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
|
assert!(p.root().join("target/doc/bar/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -168,11 +167,8 @@ fn doc_no_deps() {
|
|||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
assert_that(
|
assert!(!p.root().join("target/doc/bar/index.html").is_file());
|
||||||
&p.root().join("target/doc/bar/index.html"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -197,8 +193,8 @@ fn doc_only_bin() {
|
|||||||
p.cargo("doc -v").run();
|
p.cargo("doc -v").run();
|
||||||
|
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
|
assert!(p.root().join("target/doc/bar/index.html").is_file());
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -281,7 +277,7 @@ fn doc_multiple_targets_same_name() {
|
|||||||
.run();
|
.run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
let doc_file = p.root().join("target/doc/foo_lib/index.html");
|
let doc_file = p.root().join("target/doc/foo_lib/index.html");
|
||||||
assert_that(&doc_file, existing_file());
|
assert!(doc_file.is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -388,7 +384,7 @@ fn doc_lib_bin_same_name_documents_lib() {
|
|||||||
)).run();
|
)).run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
let doc_file = p.root().join("target/doc/foo/index.html");
|
let doc_file = p.root().join("target/doc/foo/index.html");
|
||||||
assert_that(&doc_file, existing_file());
|
assert!(doc_file.is_file());
|
||||||
let mut doc_html = String::new();
|
let mut doc_html = String::new();
|
||||||
File::open(&doc_file)
|
File::open(&doc_file)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -428,7 +424,7 @@ fn doc_lib_bin_same_name_documents_lib_when_requested() {
|
|||||||
)).run();
|
)).run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
let doc_file = p.root().join("target/doc/foo/index.html");
|
let doc_file = p.root().join("target/doc/foo/index.html");
|
||||||
assert_that(&doc_file, existing_file());
|
assert!(doc_file.is_file());
|
||||||
let mut doc_html = String::new();
|
let mut doc_html = String::new();
|
||||||
File::open(&doc_file)
|
File::open(&doc_file)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -469,7 +465,7 @@ fn doc_lib_bin_same_name_documents_named_bin_when_requested() {
|
|||||||
)).run();
|
)).run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
let doc_file = p.root().join("target/doc/foo/index.html");
|
let doc_file = p.root().join("target/doc/foo/index.html");
|
||||||
assert_that(&doc_file, existing_file());
|
assert!(doc_file.is_file());
|
||||||
let mut doc_html = String::new();
|
let mut doc_html = String::new();
|
||||||
File::open(&doc_file)
|
File::open(&doc_file)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -510,7 +506,7 @@ fn doc_lib_bin_same_name_documents_bins_when_requested() {
|
|||||||
)).run();
|
)).run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
let doc_file = p.root().join("target/doc/foo/index.html");
|
let doc_file = p.root().join("target/doc/foo/index.html");
|
||||||
assert_that(&doc_file, existing_file());
|
assert!(doc_file.is_file());
|
||||||
let mut doc_html = String::new();
|
let mut doc_html = String::new();
|
||||||
File::open(&doc_file)
|
File::open(&doc_file)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -593,10 +589,10 @@ fn doc_target() {
|
|||||||
|
|
||||||
p.cargo("doc --verbose --target").arg(TARGET).run();
|
p.cargo("doc --verbose --target").arg(TARGET).run();
|
||||||
assert!(p.root().join(&format!("target/{}/doc", TARGET)).is_dir());
|
assert!(p.root().join(&format!("target/{}/doc", TARGET)).is_dir());
|
||||||
assert_that(
|
assert!(
|
||||||
&p.root()
|
p.root()
|
||||||
.join(&format!("target/{}/doc/foo/index.html", TARGET)),
|
.join(&format!("target/{}/doc/foo/index.html", TARGET))
|
||||||
existing_file(),
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,8 +761,8 @@ fn doc_multiple_deps() {
|
|||||||
p.cargo("doc -p bar -p baz -v").run();
|
p.cargo("doc -p bar -p baz -v").run();
|
||||||
|
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
|
assert!(p.root().join("target/doc/bar/index.html").is_file());
|
||||||
assert_that(&p.root().join("target/doc/baz/index.html"), existing_file());
|
assert!(p.root().join("target/doc/baz/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -811,14 +807,8 @@ fn features() {
|
|||||||
).build();
|
).build();
|
||||||
p.cargo("doc --features foo").run();
|
p.cargo("doc --features foo").run();
|
||||||
assert!(p.root().join("target/doc").is_dir());
|
assert!(p.root().join("target/doc").is_dir());
|
||||||
assert_that(
|
assert!(p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||||
&p.root().join("target/doc/foo/fn.foo.html"),
|
assert!(p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("target/doc/bar/fn.bar.html"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -833,12 +823,12 @@ fn rerun_when_dir_removed() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("doc").run();
|
p.cargo("doc").run();
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
|
|
||||||
fs::remove_dir_all(p.root().join("target/doc/foo")).unwrap();
|
fs::remove_dir_all(p.root().join("target/doc/foo")).unwrap();
|
||||||
|
|
||||||
p.cargo("doc").run();
|
p.cargo("doc").run();
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -861,7 +851,7 @@ fn document_only_lib() {
|
|||||||
"#,
|
"#,
|
||||||
).build();
|
).build();
|
||||||
p.cargo("doc --lib").run();
|
p.cargo("doc --lib").run();
|
||||||
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
|
assert!(p.root().join("target/doc/foo/index.html").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1219,9 +1209,10 @@ fn doc_private_items() {
|
|||||||
foo.cargo("doc --document-private-items").run();
|
foo.cargo("doc --document-private-items").run();
|
||||||
|
|
||||||
assert!(foo.root().join("target/doc").is_dir());
|
assert!(foo.root().join("target/doc").is_dir());
|
||||||
assert_that(
|
assert!(
|
||||||
&foo.root().join("target/doc/foo/private/index.html"),
|
foo.root()
|
||||||
existing_file(),
|
.join("target/doc/foo/private/index.html")
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::sleep_ms;
|
use support::sleep_ms;
|
||||||
@ -65,7 +64,7 @@ fn modify_only_some_files() {
|
|||||||
p.cargo("test").run();
|
p.cargo("test").run();
|
||||||
sleep_ms(1000);
|
sleep_ms(1000);
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
let lib = p.root().join("src/lib.rs");
|
let lib = p.root().join("src/lib.rs");
|
||||||
let bin = p.root().join("src/b.rs");
|
let bin = p.root().join("src/b.rs");
|
||||||
@ -89,7 +88,7 @@ fn modify_only_some_files() {
|
|||||||
",
|
",
|
||||||
dir = path2url(p.root())
|
dir = path2url(p.root())
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_manifest, paths, project, ProjectBuilder};
|
use support::{basic_manifest, paths, project, ProjectBuilder};
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ fn preserve_line_endings_issue_2076() {
|
|||||||
|
|
||||||
let lockfile = p.root().join("Cargo.lock");
|
let lockfile = p.root().join("Cargo.lock");
|
||||||
p.cargo("generate-lockfile").run();
|
p.cargo("generate-lockfile").run();
|
||||||
assert_that(&lockfile, existing_file());
|
assert!(lockfile.is_file());
|
||||||
p.cargo("generate-lockfile").run();
|
p.cargo("generate-lockfile").run();
|
||||||
|
|
||||||
let lock0 = p.read_lockfile();
|
let lock0 = p.read_lockfile();
|
||||||
@ -165,15 +164,15 @@ fn cargo_update_generate_lockfile() {
|
|||||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
let p = project().file("src/main.rs", "fn main() {}").build();
|
||||||
|
|
||||||
let lockfile = p.root().join("Cargo.lock");
|
let lockfile = p.root().join("Cargo.lock");
|
||||||
assert_that(&lockfile, is_not(existing_file()));
|
assert!(!lockfile.is_file());
|
||||||
p.cargo("update").with_stdout("").run();
|
p.cargo("update").with_stdout("").run();
|
||||||
assert_that(&lockfile, existing_file());
|
assert!(lockfile.is_file());
|
||||||
|
|
||||||
fs::remove_file(p.root().join("Cargo.lock")).unwrap();
|
fs::remove_file(p.root().join("Cargo.lock")).unwrap();
|
||||||
|
|
||||||
assert_that(&lockfile, is_not(existing_file()));
|
assert!(!lockfile.is_file());
|
||||||
p.cargo("update").with_stdout("").run();
|
p.cargo("update").with_stdout("").run();
|
||||||
assert_that(&lockfile, existing_file());
|
assert!(lockfile.is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -7,7 +7,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::paths::{self, CargoPathExt};
|
use support::paths::{self, CargoPathExt};
|
||||||
use support::sleep_ms;
|
use support::sleep_ms;
|
||||||
use support::{basic_lib_manifest, basic_manifest, git, main_file, path2url, project};
|
use support::{basic_lib_manifest, basic_manifest, git, main_file, path2url, project};
|
||||||
@ -65,7 +64,7 @@ fn cargo_compile_simple_git_dep() {
|
|||||||
path2url(root)
|
path2url(root)
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&project.bin("foo"), existing_file());
|
assert!(project.bin("foo").is_file());
|
||||||
|
|
||||||
project
|
project
|
||||||
.process(&project.bin("foo"))
|
.process(&project.bin("foo"))
|
||||||
@ -202,7 +201,7 @@ fn cargo_compile_offline_with_cached_git_dep() {
|
|||||||
path2url(root)
|
path2url(root)
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo"))
|
p.process(&p.bin("foo"))
|
||||||
.with_stdout("hello from cached git repo rev2\n")
|
.with_stdout("hello from cached git repo rev2\n")
|
||||||
@ -293,7 +292,7 @@ fn cargo_compile_git_dep_branch() {
|
|||||||
path2url(root)
|
path2url(root)
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&project.bin("foo"), existing_file());
|
assert!(project.bin("foo").is_file());
|
||||||
|
|
||||||
project
|
project
|
||||||
.process(&project.bin("foo"))
|
.process(&project.bin("foo"))
|
||||||
@ -366,7 +365,7 @@ fn cargo_compile_git_dep_tag() {
|
|||||||
path2url(root)
|
path2url(root)
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&project.bin("foo"), existing_file());
|
assert!(project.bin("foo").is_file());
|
||||||
|
|
||||||
project
|
project
|
||||||
.process(&project.bin("foo"))
|
.process(&project.bin("foo"))
|
||||||
@ -447,7 +446,7 @@ fn cargo_compile_with_nested_paths() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello world\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello world\n").run();
|
||||||
}
|
}
|
||||||
@ -496,7 +495,7 @@ fn cargo_compile_with_malformed_nested_paths() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello world\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello world\n").run();
|
||||||
}
|
}
|
||||||
@ -562,7 +561,7 @@ fn cargo_compile_with_meta_package() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo"))
|
p.process(&p.bin("foo"))
|
||||||
.with_stdout("this is dep1 this is dep2\n")
|
.with_stdout("this is dep1 this is dep2\n")
|
||||||
@ -692,7 +691,7 @@ fn two_revs_same_deps() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
foo.cargo("build -v").run();
|
foo.cargo("build -v").run();
|
||||||
assert_that(&foo.bin("foo"), existing_file());
|
assert!(foo.bin("foo").is_file());
|
||||||
foo.process(&foo.bin("foo")).run();
|
foo.process(&foo.bin("foo")).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ use std::fs::{self, File};
|
|||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use support;
|
use support;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::{paths, Execs};
|
use support::{paths, Execs};
|
||||||
|
|
||||||
fn cargo_process(s: &str) -> Execs {
|
fn cargo_process(s: &str) -> Execs {
|
||||||
@ -19,9 +18,9 @@ fn simple_lib() {
|
|||||||
.with_stderr("[CREATED] library project")
|
.with_stderr("[CREATED] library project")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert_that(&paths::root().join(".gitignore"), is_not(existing_file()));
|
assert!(!paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
cargo_process("build").run();
|
cargo_process("build").run();
|
||||||
}
|
}
|
||||||
@ -36,13 +35,14 @@ fn simple_bin() {
|
|||||||
.with_stderr("[CREATED] binary (application) project")
|
.with_stderr("[CREATED] binary (application) project")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("foo/src/main.rs"), existing_file());
|
assert!(paths::root().join("foo/src/main.rs").is_file());
|
||||||
|
|
||||||
cargo_process("build").cwd(&path).run();
|
cargo_process("build").cwd(&path).run();
|
||||||
assert_that(
|
assert!(
|
||||||
&paths::root().join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX)),
|
paths::root()
|
||||||
existing_file(),
|
.join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX))
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,11 +84,8 @@ fn bin_already_exists(explicit: bool, rellocation: &str) {
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(
|
assert!(!paths::root().join("foo/src/lib.rs").is_file());
|
||||||
&paths::root().join("foo/src/lib.rs"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check that our file is not overwritten
|
// Check that our file is not overwritten
|
||||||
let mut new_content = Vec::new();
|
let mut new_content = Vec::new();
|
||||||
@ -153,10 +150,7 @@ fn confused_by_multiple_lib_files() {
|
|||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(
|
assert!(!paths::root().join("foo/Cargo.toml").is_file());
|
||||||
&paths::root().join("foo/Cargo.toml"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -191,10 +185,7 @@ cannot automatically generate Cargo.toml as the main target would be ambiguous
|
|||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
assert_that(
|
assert!(!paths::root().join("foo/Cargo.toml").is_file());
|
||||||
&paths::root().join("foo/Cargo.toml"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lib_already_exists(rellocation: &str) {
|
fn lib_already_exists(rellocation: &str) {
|
||||||
@ -217,11 +208,8 @@ fn lib_already_exists(rellocation: &str) {
|
|||||||
.cwd(&path)
|
.cwd(&path)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(
|
assert!(!paths::root().join("foo/src/main.rs").is_file());
|
||||||
&paths::root().join("foo/src/main.rs"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check that our file is not overwritten
|
// Check that our file is not overwritten
|
||||||
let mut new_content = Vec::new();
|
let mut new_content = Vec::new();
|
||||||
@ -248,20 +236,20 @@ fn simple_git() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert!(paths::root().join(".git").is_dir());
|
assert!(paths::root().join(".git").is_dir());
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn auto_git() {
|
fn auto_git() {
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert!(paths::root().join(".git").is_dir());
|
assert!(paths::root().join(".git").is_dir());
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -279,7 +267,7 @@ use --name to override crate name
|
|||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
assert_that(&foo.join("Cargo.toml"), is_not(existing_file()));
|
assert!(!foo.join("Cargo.toml").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -297,7 +285,7 @@ use --name to override crate name
|
|||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
assert_that(&test.join("Cargo.toml"), is_not(existing_file()));
|
assert!(!test.join("Cargo.toml").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -306,10 +294,10 @@ fn git_autodetect() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert!(paths::root().join(".git").is_dir());
|
assert!(paths::root().join(".git").is_dir());
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -318,10 +306,10 @@ fn mercurial_autodetect() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert!(!paths::root().join(".git").is_dir());
|
assert!(!paths::root().join(".git").is_dir());
|
||||||
assert_that(&paths::root().join(".hgignore"), existing_file());
|
assert!(paths::root().join(".hgignore").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -335,10 +323,10 @@ fn gitignore_appended_not_replaced() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join("Cargo.toml"), existing_file());
|
assert!(paths::root().join("Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("src/lib.rs"), existing_file());
|
assert!(paths::root().join("src/lib.rs").is_file());
|
||||||
assert!(paths::root().join(".git").is_dir());
|
assert!(paths::root().join(".git").is_dir());
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -359,7 +347,7 @@ fn gitignore_added_newline_in_existing() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -375,7 +363,7 @@ fn gitignore_no_newline_in_new() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -396,7 +384,7 @@ fn mercurial_added_newline_in_existing() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".hgignore"), existing_file());
|
assert!(paths::root().join(".hgignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".hgignore"))
|
File::open(&paths::root().join(".hgignore"))
|
||||||
@ -412,7 +400,7 @@ fn mercurial_no_newline_in_new() {
|
|||||||
|
|
||||||
cargo_process("init --lib").env("USER", "foo").run();
|
cargo_process("init --lib").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".hgignore"), existing_file());
|
assert!(paths::root().join(".hgignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".hgignore"))
|
File::open(&paths::root().join(".hgignore"))
|
||||||
@ -430,7 +418,7 @@ fn cargo_lock_gitignored_if_lib1() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -451,7 +439,7 @@ fn cargo_lock_gitignored_if_lib2() {
|
|||||||
|
|
||||||
cargo_process("init --vcs git").env("USER", "foo").run();
|
cargo_process("init --vcs git").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -469,7 +457,7 @@ fn cargo_lock_not_gitignored_if_bin1() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -490,7 +478,7 @@ fn cargo_lock_not_gitignored_if_bin2() {
|
|||||||
|
|
||||||
cargo_process("init --vcs git").env("USER", "foo").run();
|
cargo_process("init --vcs git").env("USER", "foo").run();
|
||||||
|
|
||||||
assert_that(&paths::root().join(".gitignore"), existing_file());
|
assert!(paths::root().join(".gitignore").is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&paths::root().join(".gitignore"))
|
File::open(&paths::root().join(".gitignore"))
|
||||||
@ -505,7 +493,7 @@ fn with_argument() {
|
|||||||
cargo_process("init foo --vcs none")
|
cargo_process("init foo --vcs none")
|
||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -4,7 +4,6 @@ use std::io::prelude::*;
|
|||||||
use cargo::core::Shell;
|
use cargo::core::Shell;
|
||||||
use cargo::util::config::Config;
|
use cargo::util::config::Config;
|
||||||
use support::cargo_process;
|
use support::cargo_process;
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::install::cargo_home;
|
use support::install::cargo_home;
|
||||||
use support::registry::registry;
|
use support::registry::registry;
|
||||||
use toml;
|
use toml;
|
||||||
@ -34,7 +33,7 @@ fn setup_new_credentials() {
|
|||||||
|
|
||||||
fn check_token(expected_token: &str, registry: Option<&str>) -> bool {
|
fn check_token(expected_token: &str, registry: Option<&str>) -> bool {
|
||||||
let credentials = cargo_home().join("credentials");
|
let credentials = cargo_home().join("credentials");
|
||||||
assert_that(&credentials, existing_file());
|
assert!(credentials.is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&credentials)
|
File::open(&credentials)
|
||||||
@ -81,7 +80,7 @@ fn login_with_old_credentials() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
let config = cargo_home().join("config");
|
let config = cargo_home().join("config");
|
||||||
assert_that(&config, existing_file());
|
assert!(config.is_file());
|
||||||
|
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
File::open(&config)
|
File::open(&config)
|
||||||
@ -104,7 +103,7 @@ fn login_with_new_credentials() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
let config = cargo_home().join("config");
|
let config = cargo_home().join("config");
|
||||||
assert_that(&config, is_not(existing_file()));
|
assert!(!config.is_file());
|
||||||
|
|
||||||
// Ensure that we get the new token for the registry
|
// Ensure that we get the new token for the registry
|
||||||
assert!(check_token(TOKEN, None));
|
assert!(check_token(TOKEN, None));
|
||||||
@ -124,7 +123,7 @@ fn login_without_credentials() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
let config = cargo_home().join("config");
|
let config = cargo_home().join("config");
|
||||||
assert_that(&config, is_not(existing_file()));
|
assert!(!config.is_file());
|
||||||
|
|
||||||
// Ensure that we get the new token for the registry
|
// Ensure that we get the new token for the registry
|
||||||
assert!(check_token(TOKEN, None));
|
assert!(check_token(TOKEN, None));
|
||||||
|
@ -2,7 +2,6 @@ use std::env;
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::paths;
|
use support::paths;
|
||||||
use support::{cargo_process, git_process};
|
use support::{cargo_process, git_process};
|
||||||
|
|
||||||
@ -21,12 +20,9 @@ fn simple_lib() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo").is_dir());
|
assert!(paths::root().join("foo").is_dir());
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("foo/src/lib.rs"), existing_file());
|
assert!(paths::root().join("foo/src/lib.rs").is_file());
|
||||||
assert_that(
|
assert!(!paths::root().join("foo/.gitignore").is_file());
|
||||||
&paths::root().join("foo/.gitignore"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
|
|
||||||
let lib = paths::root().join("foo/src/lib.rs");
|
let lib = paths::root().join("foo/src/lib.rs");
|
||||||
let mut contents = String::new();
|
let mut contents = String::new();
|
||||||
@ -57,13 +53,14 @@ fn simple_bin() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo").is_dir());
|
assert!(paths::root().join("foo").is_dir());
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("foo/src/main.rs"), existing_file());
|
assert!(paths::root().join("foo/src/main.rs").is_file());
|
||||||
|
|
||||||
cargo_process("build").cwd(&paths::root().join("foo")).run();
|
cargo_process("build").cwd(&paths::root().join("foo")).run();
|
||||||
assert_that(
|
assert!(
|
||||||
&paths::root().join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX)),
|
paths::root()
|
||||||
existing_file(),
|
.join(&format!("foo/target/debug/foo{}", env::consts::EXE_SUFFIX))
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +78,10 @@ fn simple_git() {
|
|||||||
cargo_process("new --lib foo").env("USER", "foo").run();
|
cargo_process("new --lib foo").env("USER", "foo").run();
|
||||||
|
|
||||||
assert!(paths::root().is_dir());
|
assert!(paths::root().is_dir());
|
||||||
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
|
assert!(paths::root().join("foo/Cargo.toml").is_file());
|
||||||
assert_that(&paths::root().join("foo/src/lib.rs"), existing_file());
|
assert!(paths::root().join("foo/src/lib.rs").is_file());
|
||||||
assert!(paths::root().join("foo/.git").is_dir());
|
assert!(paths::root().join("foo/.git").is_dir());
|
||||||
assert_that(&paths::root().join("foo/.gitignore"), existing_file());
|
assert!(paths::root().join("foo/.gitignore").is_file());
|
||||||
|
|
||||||
cargo_process("build").cwd(&paths::root().join("foo")).run();
|
cargo_process("build").cwd(&paths::root().join("foo")).run();
|
||||||
}
|
}
|
||||||
@ -365,7 +362,7 @@ fn subpackage_no_git() {
|
|||||||
cargo_process("new foo").env("USER", "foo").run();
|
cargo_process("new foo").env("USER", "foo").run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo/.git").is_dir());
|
assert!(paths::root().join("foo/.git").is_dir());
|
||||||
assert_that(&paths::root().join("foo/.gitignore"), existing_file());
|
assert!(paths::root().join("foo/.gitignore").is_file());
|
||||||
|
|
||||||
let subpackage = paths::root().join("foo").join("components");
|
let subpackage = paths::root().join("foo").join("components");
|
||||||
fs::create_dir(&subpackage).unwrap();
|
fs::create_dir(&subpackage).unwrap();
|
||||||
@ -373,13 +370,15 @@ fn subpackage_no_git() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_that(
|
assert!(
|
||||||
&paths::root().join("foo/components/subcomponent/.git"),
|
!paths::root()
|
||||||
is_not(existing_file()),
|
.join("foo/components/subcomponent/.git")
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
assert_that(
|
assert!(
|
||||||
&paths::root().join("foo/components/subcomponent/.gitignore"),
|
!paths::root()
|
||||||
is_not(existing_file()),
|
.join("foo/components/subcomponent/.gitignore")
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +387,7 @@ fn subpackage_git_with_gitignore() {
|
|||||||
cargo_process("new foo").env("USER", "foo").run();
|
cargo_process("new foo").env("USER", "foo").run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo/.git").is_dir());
|
assert!(paths::root().join("foo/.git").is_dir());
|
||||||
assert_that(&paths::root().join("foo/.gitignore"), existing_file());
|
assert!(paths::root().join("foo/.gitignore").is_file());
|
||||||
|
|
||||||
let gitignore = paths::root().join("foo/.gitignore");
|
let gitignore = paths::root().join("foo/.gitignore");
|
||||||
fs::write(gitignore, b"components").unwrap();
|
fs::write(gitignore, b"components").unwrap();
|
||||||
@ -399,10 +398,15 @@ fn subpackage_git_with_gitignore() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo/components/subcomponent/.git").is_dir());
|
assert!(
|
||||||
assert_that(
|
paths::root()
|
||||||
&paths::root().join("foo/components/subcomponent/.gitignore"),
|
.join("foo/components/subcomponent/.git")
|
||||||
existing_file(),
|
.is_dir()
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
paths::root()
|
||||||
|
.join("foo/components/subcomponent/.gitignore")
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,10 +420,15 @@ fn subpackage_git_with_vcs_arg() {
|
|||||||
.env("USER", "foo")
|
.env("USER", "foo")
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert!(paths::root().join("foo/components/subcomponent/.git").is_dir());
|
assert!(
|
||||||
assert_that(
|
paths::root()
|
||||||
&paths::root().join("foo/components/subcomponent/.gitignore"),
|
.join("foo/components/subcomponent/.git")
|
||||||
existing_file(),
|
.is_dir()
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
paths::root()
|
||||||
|
.join("foo/components/subcomponent/.gitignore")
|
||||||
|
.is_file()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use flate2::read::GzDecoder;
|
use flate2::read::GzDecoder;
|
||||||
use git2;
|
use git2;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_manifest, git, is_nightly, path2url, paths, project, registry};
|
use support::{basic_manifest, git, is_nightly, path2url, paths, project, registry};
|
||||||
use support::{cargo_process, sleep_ms};
|
use support::{cargo_process, sleep_ms};
|
||||||
@ -39,10 +38,7 @@ See [..]
|
|||||||
",
|
",
|
||||||
dir = p.url()
|
dir = p.url()
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(
|
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
|
||||||
&p.root().join("target/package/foo-0.0.1.crate"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
p.cargo("package -l")
|
p.cargo("package -l")
|
||||||
.with_stdout(
|
.with_stdout(
|
||||||
"\
|
"\
|
||||||
@ -398,10 +394,7 @@ See [..]
|
|||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
|
|
||||||
assert_that(
|
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
|
||||||
&p.root().join("target/package/foo-0.0.1.crate"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
|
|
||||||
p.cargo("package -l")
|
p.cargo("package -l")
|
||||||
.with_stdout(
|
.with_stdout(
|
||||||
@ -564,10 +557,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
|
|||||||
",
|
",
|
||||||
dir = p.url()
|
dir = p.url()
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(
|
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
|
||||||
&p.root().join("target/package/foo-0.0.1.crate"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
p.cargo("package -l")
|
p.cargo("package -l")
|
||||||
.with_stdout(
|
.with_stdout(
|
||||||
"\
|
"\
|
||||||
@ -1128,10 +1118,7 @@ See [..]
|
|||||||
",
|
",
|
||||||
dir = p.url()
|
dir = p.url()
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(
|
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
|
||||||
&p.root().join("target/package/foo-0.0.1.crate"),
|
|
||||||
existing_file(),
|
|
||||||
);
|
|
||||||
p.cargo("package -l")
|
p.cargo("package -l")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo()
|
||||||
.with_stdout(
|
.with_stdout(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::paths::{self, CargoPathExt};
|
use support::paths::{self, CargoPathExt};
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::sleep_ms;
|
use support::sleep_ms;
|
||||||
@ -76,7 +75,7 @@ fn cargo_compile_with_nested_deps_shorthand() {
|
|||||||
p.url()
|
p.url()
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
p.process(&p.bin("foo")).with_stdout("test passed\n").run();
|
||||||
|
|
||||||
@ -238,7 +237,7 @@ fn cargo_compile_with_transitive_dev_deps() {
|
|||||||
p.url()
|
p.url()
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("zoidberg\n").run();
|
p.process(&p.bin("foo")).with_stdout("zoidberg\n").run();
|
||||||
}
|
}
|
||||||
@ -429,9 +428,9 @@ fn no_rebuild_two_deps() {
|
|||||||
p.url(),
|
p.url(),
|
||||||
p.url()
|
p.url()
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
p.cargo("build").with_stdout("").run();
|
p.cargo("build").with_stdout("").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -695,7 +694,7 @@ fn path_dep_build_cmd() {
|
|||||||
p.url()
|
p.url()
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("0\n").run();
|
p.process(&p.bin("foo")).with_stdout("0\n").run();
|
||||||
|
|
||||||
@ -977,11 +976,8 @@ fn workspace_produces_rlib() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.root().join("target/debug/libtop.rlib"), existing_file());
|
assert!(p.root().join("target/debug/libtop.rlib").is_file());
|
||||||
assert_that(
|
assert!(!p.root().join("target/debug/libfoo.rlib").is_file());
|
||||||
&p.root().join("target/debug/libfoo.rlib"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
use support::hamcrest::{assert_that, is_not};
|
||||||
use support::install::{cargo_home, has_installed_exe};
|
use support::install::{cargo_home, has_installed_exe};
|
||||||
use support::is_nightly;
|
use support::is_nightly;
|
||||||
use support::project;
|
use support::project;
|
||||||
@ -38,12 +38,12 @@ fn build_bin_default_features() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.cargo("build --no-default-features").run();
|
p.cargo("build --no-default-features").run();
|
||||||
|
|
||||||
p.cargo("build --bin=foo").run();
|
p.cargo("build --bin=foo").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.cargo("build --bin=foo --no-default-features")
|
p.cargo("build --bin=foo --no-default-features")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
@ -77,7 +77,7 @@ fn build_bin_arg_features() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --features a").run();
|
p.cargo("build --features a").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -113,13 +113,13 @@ fn build_bin_multiple_required_features() {
|
|||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo_1"), is_not(existing_file()));
|
assert!(!p.bin("foo_1").is_file());
|
||||||
assert_that(&p.bin("foo_2"), existing_file());
|
assert!(p.bin("foo_2").is_file());
|
||||||
|
|
||||||
p.cargo("build --features c").run();
|
p.cargo("build --features c").run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo_1"), existing_file());
|
assert!(p.bin("foo_1").is_file());
|
||||||
assert_that(&p.bin("foo_2"), existing_file());
|
assert!(p.bin("foo_2").is_file());
|
||||||
|
|
||||||
p.cargo("build --no-default-features").run();
|
p.cargo("build --no-default-features").run();
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ fn build_example_default_features() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=foo").run();
|
p.cargo("build --example=foo").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
|
|
||||||
p.cargo("build --example=foo --no-default-features")
|
p.cargo("build --example=foo --no-default-features")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
@ -181,7 +181,7 @@ fn build_example_arg_features() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --example=foo --features a").run();
|
p.cargo("build --example=foo --features a").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -223,14 +223,14 @@ Consider enabling them by passing e.g. `--features=\"b c\"`
|
|||||||
).run();
|
).run();
|
||||||
p.cargo("build --example=foo_2").run();
|
p.cargo("build --example=foo_2").run();
|
||||||
|
|
||||||
assert_that(&p.bin("examples/foo_1"), is_not(existing_file()));
|
assert!(!p.bin("examples/foo_1").is_file());
|
||||||
assert_that(&p.bin("examples/foo_2"), existing_file());
|
assert!(p.bin("examples/foo_2").is_file());
|
||||||
|
|
||||||
p.cargo("build --example=foo_1 --features c").run();
|
p.cargo("build --example=foo_1 --features c").run();
|
||||||
p.cargo("build --example=foo_2 --features c").run();
|
p.cargo("build --example=foo_2 --features c").run();
|
||||||
|
|
||||||
assert_that(&p.bin("examples/foo_1"), existing_file());
|
assert!(p.bin("examples/foo_1").is_file());
|
||||||
assert_that(&p.bin("examples/foo_2"), existing_file());
|
assert!(p.bin("examples/foo_2").is_file());
|
||||||
|
|
||||||
p.cargo("build --example=foo_1 --no-default-features")
|
p.cargo("build --example=foo_1 --no-default-features")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
@ -801,11 +801,11 @@ fn dep_feature_in_toml() {
|
|||||||
|
|
||||||
// bin
|
// bin
|
||||||
p.cargo("build --bin=foo").run();
|
p.cargo("build --bin=foo").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
// example
|
// example
|
||||||
p.cargo("build --example=foo").run();
|
p.cargo("build --example=foo").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
|
|
||||||
// test
|
// test
|
||||||
p.cargo("test --test=foo")
|
p.cargo("test --test=foo")
|
||||||
@ -907,7 +907,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"`
|
|||||||
).run();
|
).run();
|
||||||
|
|
||||||
p.cargo("build --bin=foo --features bar/a").run();
|
p.cargo("build --bin=foo --features bar/a").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
// example
|
// example
|
||||||
p.cargo("build --example=foo")
|
p.cargo("build --example=foo")
|
||||||
@ -920,7 +920,7 @@ Consider enabling them by passing e.g. `--features=\"bar/a\"`
|
|||||||
).run();
|
).run();
|
||||||
|
|
||||||
p.cargo("build --example=foo --features bar/a").run();
|
p.cargo("build --example=foo --features bar/a").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
|
|
||||||
// test
|
// test
|
||||||
p.cargo("test")
|
p.cargo("test")
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use cargo::util::paths::dylib_path_envvar;
|
use cargo::util::paths::dylib_path_envvar;
|
||||||
use support;
|
use support;
|
||||||
use support::hamcrest::{assert_that, existing_file};
|
|
||||||
use support::{basic_bin_manifest, basic_lib_manifest, path2url, project, Project};
|
use support::{basic_bin_manifest, basic_lib_manifest, path2url, project, Project};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -18,7 +17,7 @@ fn simple() {
|
|||||||
dir = path2url(p.root())
|
dir = path2url(p.root())
|
||||||
)).with_stdout("hello")
|
)).with_stdout("hello")
|
||||||
.run();
|
.run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -726,7 +725,7 @@ fn release_works() {
|
|||||||
",
|
",
|
||||||
dir = path2url(p.root()),
|
dir = path2url(p.root()),
|
||||||
)).run();
|
)).run();
|
||||||
assert_that(&p.release_bin("foo"), existing_file());
|
assert!(p.release_bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker;
|
use std::marker;
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
pub type MatchResult = Result<(), String>;
|
pub type MatchResult = Result<(), String>;
|
||||||
|
|
||||||
@ -14,26 +13,6 @@ pub fn assert_that<T, U: Matcher<T>>(actual: T, matcher: U) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn existing_file() -> ExistingFile {
|
|
||||||
ExistingFile
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct ExistingFile;
|
|
||||||
|
|
||||||
impl<P> Matcher<P> for ExistingFile
|
|
||||||
where
|
|
||||||
P: AsRef<Path>,
|
|
||||||
{
|
|
||||||
fn matches(&self, actual: P) -> Result<(), String> {
|
|
||||||
if actual.as_ref().is_file() {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(format!("{} was not a file", actual.as_ref().display()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn is_not<T, M: Matcher<T>>(matcher: M) -> IsNot<T, M> {
|
pub fn is_not<T, M: Matcher<T>>(matcher: M) -> IsNot<T, M> {
|
||||||
IsNot {
|
IsNot {
|
||||||
matcher,
|
matcher,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use support::hamcrest::{existing_file, MatchResult, Matcher};
|
use support::hamcrest::{MatchResult, Matcher};
|
||||||
|
|
||||||
use support::paths;
|
use support::paths;
|
||||||
|
|
||||||
@ -28,7 +28,11 @@ pub fn exe(name: &str) -> String {
|
|||||||
impl<P: AsRef<Path>> Matcher<P> for InstalledExe {
|
impl<P: AsRef<Path>> Matcher<P> for InstalledExe {
|
||||||
fn matches(&self, path: P) -> MatchResult {
|
fn matches(&self, path: P) -> MatchResult {
|
||||||
let path = path.as_ref().join("bin").join(exe(self.0));
|
let path = path.as_ref().join("bin").join(exe(self.0));
|
||||||
existing_file().matches(&path)
|
if path.is_file() {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(format!("{} was not a file", path.display()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ use std::fs::File;
|
|||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
|
||||||
use cargo;
|
use cargo;
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::paths::CargoPathExt;
|
use support::paths::CargoPathExt;
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, project};
|
use support::{basic_bin_manifest, basic_lib_manifest, basic_manifest, cargo_exe, project};
|
||||||
@ -30,7 +29,7 @@ fn cargo_test_simple() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
||||||
|
|
||||||
@ -133,7 +132,7 @@ fn cargo_test_overflow_checks() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build --release").run();
|
p.cargo("build --release").run();
|
||||||
assert_that(&p.release_bin("foo"), existing_file());
|
assert!(p.release_bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.release_bin("foo")).with_stdout("").run();
|
p.process(&p.release_bin("foo")).with_stdout("").run();
|
||||||
}
|
}
|
||||||
@ -215,7 +214,7 @@ fn cargo_test_failing_test_in_bin() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
||||||
|
|
||||||
@ -260,7 +259,7 @@ fn cargo_test_failing_test_in_test() {
|
|||||||
).build();
|
).build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
p.process(&p.bin("foo")).with_stdout("hello\n").run();
|
||||||
|
|
||||||
@ -1697,8 +1696,8 @@ fn example_bin_same_name() {
|
|||||||
dir = p.url()
|
dir = p.url()
|
||||||
)).run();
|
)).run();
|
||||||
|
|
||||||
assert_that(&p.bin("foo"), is_not(existing_file()));
|
assert!(!p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
|
|
||||||
p.process(&p.bin("examples/foo"))
|
p.process(&p.bin("examples/foo"))
|
||||||
.with_stdout("example\n")
|
.with_stdout("example\n")
|
||||||
@ -1712,7 +1711,7 @@ fn example_bin_same_name() {
|
|||||||
[RUNNING] [..]",
|
[RUNNING] [..]",
|
||||||
).with_stdout("bin")
|
).with_stdout("bin")
|
||||||
.run();
|
.run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1724,10 +1723,10 @@ fn test_with_example_twice() {
|
|||||||
|
|
||||||
println!("first");
|
println!("first");
|
||||||
p.cargo("test -v").run();
|
p.cargo("test -v").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
println!("second");
|
println!("second");
|
||||||
p.cargo("test -v").run();
|
p.cargo("test -v").run();
|
||||||
assert_that(&p.bin("examples/foo"), existing_file());
|
assert!(p.bin("examples/foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1778,11 +1777,11 @@ fn bin_is_preserved() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v").run();
|
p.cargo("build -v").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
|
|
||||||
println!("testing");
|
println!("testing");
|
||||||
p.cargo("test -v").run();
|
p.cargo("test -v").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2,7 +2,6 @@ use std::env;
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
use support::hamcrest::{assert_that, existing_file, is_not};
|
|
||||||
use support::registry::Package;
|
use support::registry::Package;
|
||||||
use support::sleep_ms;
|
use support::sleep_ms;
|
||||||
use support::{basic_lib_manifest, basic_manifest, git, project};
|
use support::{basic_lib_manifest, basic_manifest, git, project};
|
||||||
@ -35,15 +34,15 @@ fn simple_explicit() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -75,8 +74,8 @@ fn simple_explicit_default_members() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("foo"), is_not(existing_file()));
|
assert!(!p.bin("foo").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -99,15 +98,15 @@ fn inferred_root() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -133,15 +132,15 @@ fn inferred_path_dep() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -180,23 +179,23 @@ fn transitive_path_dep() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), is_not(existing_file()));
|
assert!(!p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), is_not(existing_file()));
|
assert!(!p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("baz")).run();
|
p.cargo("build").cwd(p.root().join("baz")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), existing_file());
|
assert!(p.bin("baz").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("baz/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("baz/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -231,8 +230,8 @@ fn parent_pointer_works() {
|
|||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("foo")).run();
|
p.cargo("build").cwd(p.root().join("foo")).run();
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.root().join("foo/Cargo.lock"), existing_file());
|
assert!(p.root().join("foo/Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -683,9 +682,9 @@ fn virtual_works() {
|
|||||||
.file("bar/src/main.rs", "fn main() {}");
|
.file("bar/src/main.rs", "fn main() {}");
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
p.cargo("build").cwd(p.root().join("bar")).run();
|
p.cargo("build").cwd(p.root().join("bar")).run();
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -701,9 +700,9 @@ fn explicit_package_argument_works_with_virtual_manifest() {
|
|||||||
.file("bar/src/main.rs", "fn main() {}");
|
.file("bar/src/main.rs", "fn main() {}");
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
p.cargo("build --package bar").cwd(p.root()).run();
|
p.cargo("build --package bar").cwd(p.root()).run();
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -763,8 +762,8 @@ fn virtual_default_members() {
|
|||||||
.file("baz/src/main.rs", "fn main() {}");
|
.file("baz/src/main.rs", "fn main() {}");
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), is_not(existing_file()));
|
assert!(!p.bin("baz").is_file());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1305,17 +1304,17 @@ fn test_in_and_out_of_workspace() {
|
|||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("ws")).run();
|
p.cargo("build").cwd(p.root().join("ws")).run();
|
||||||
|
|
||||||
assert_that(&p.root().join("ws/Cargo.lock"), existing_file());
|
assert!(p.root().join("ws/Cargo.lock").is_file());
|
||||||
assert!(p.root().join("ws/target").is_dir());
|
assert!(p.root().join("ws/target").is_dir());
|
||||||
assert_that(&p.root().join("foo/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("foo/Cargo.lock").is_file());
|
||||||
assert!(!p.root().join("foo/target").is_dir());
|
assert!(!p.root().join("foo/target").is_dir());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
assert!(!p.root().join("bar/target").is_dir());
|
assert!(!p.root().join("bar/target").is_dir());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("foo")).run();
|
p.cargo("build").cwd(p.root().join("foo")).run();
|
||||||
assert_that(&p.root().join("foo/Cargo.lock"), existing_file());
|
assert!(p.root().join("foo/Cargo.lock").is_file());
|
||||||
assert!(p.root().join("foo/target").is_dir());
|
assert!(p.root().join("foo/target").is_dir());
|
||||||
assert_that(&p.root().join("bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("bar/Cargo.lock").is_file());
|
||||||
assert!(!p.root().join("bar/target").is_dir());
|
assert!(!p.root().join("bar/target").is_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1359,18 +1358,12 @@ fn test_path_dependency_under_member() {
|
|||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("ws")).run();
|
p.cargo("build").cwd(p.root().join("ws")).run();
|
||||||
|
|
||||||
assert_that(
|
assert!(!p.root().join("foo/bar/Cargo.lock").is_file());
|
||||||
&p.root().join("foo/bar/Cargo.lock"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert!(!p.root().join("foo/bar/target").is_dir());
|
assert!(!p.root().join("foo/bar/target").is_dir());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("foo/bar")).run();
|
p.cargo("build").cwd(p.root().join("foo/bar")).run();
|
||||||
|
|
||||||
assert_that(
|
assert!(!p.root().join("foo/bar/Cargo.lock").is_file());
|
||||||
&p.root().join("foo/bar/Cargo.lock"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert!(!p.root().join("foo/bar/target").is_dir());
|
assert!(!p.root().join("foo/bar/target").is_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1501,31 +1494,25 @@ fn glob_syntax() {
|
|||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), is_not(existing_file()));
|
assert!(!p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/bar")).run();
|
p.cargo("build").cwd(p.root().join("crates/bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/baz")).run();
|
p.cargo("build").cwd(p.root().join("crates/baz")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("baz"), existing_file());
|
assert!(p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/qux")).run();
|
p.cargo("build").cwd(p.root().join("crates/qux")).run();
|
||||||
assert_that(&p.bin("qux"), is_not(existing_file()));
|
assert!(!p.bin("qux").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(
|
assert!(!p.root().join("crates/bar/Cargo.lock").is_file());
|
||||||
&p.root().join("crates/bar/Cargo.lock"),
|
assert!(!p.root().join("crates/baz/Cargo.lock").is_file());
|
||||||
is_not(existing_file()),
|
assert!(p.root().join("crates/qux/Cargo.lock").is_file());
|
||||||
);
|
|
||||||
assert_that(
|
|
||||||
&p.root().join("crates/baz/Cargo.lock"),
|
|
||||||
is_not(existing_file()),
|
|
||||||
);
|
|
||||||
assert_that(&p.root().join("crates/qux/Cargo.lock"), existing_file());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FIXME: This fails because of how workspace.exclude and workspace.members are working.
|
/*FIXME: This fails because of how workspace.exclude and workspace.members are working.
|
||||||
@ -1569,25 +1556,25 @@ fn glob_syntax_2() {
|
|||||||
p.build();
|
p.build();
|
||||||
|
|
||||||
p.cargo("build").run();
|
p.cargo("build").run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), is_not(existing_file()));
|
assert!(!p.bin("bar").is_file());
|
||||||
assert_that(&p.bin("baz"), is_not(existing_file()));
|
assert!(!p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/bar")).run();
|
p.cargo("build").cwd(p.root().join("crates/bar")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("bar"), existing_file());
|
assert!(p.bin("bar").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/baz")).run();
|
p.cargo("build").cwd(p.root().join("crates/baz")).run();
|
||||||
assert_that(&p.bin("foo"), existing_file());
|
assert!(p.bin("foo").is_file());
|
||||||
assert_that(&p.bin("baz"), existing_file());
|
assert!(p.bin("baz").is_file());
|
||||||
|
|
||||||
p.cargo("build").cwd(p.root().join("crates/qux")).run();
|
p.cargo("build").cwd(p.root().join("crates/qux")).run();
|
||||||
assert_that(&p.bin("qux"), is_not(existing_file()));
|
assert!(!p.bin("qux").is_file());
|
||||||
|
|
||||||
assert_that(&p.root().join("Cargo.lock"), existing_file());
|
assert!(p.root().join("Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("crates/bar/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("crates/bar/Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("crates/baz/Cargo.lock"), is_not(existing_file()));
|
assert!(!p.root().join("crates/baz/Cargo.lock").is_file());
|
||||||
assert_that(&p.root().join("crates/qux/Cargo.lock"), existing_file());
|
assert!(p.root().join("crates/qux/Cargo.lock").is_file());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1687,8 +1674,8 @@ fn dep_used_with_separate_features() {
|
|||||||
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
||||||
",
|
",
|
||||||
).run();
|
).run();
|
||||||
assert_that(&p.bin("caller1"), existing_file());
|
assert!(p.bin("caller1").is_file());
|
||||||
assert_that(&p.bin("caller2"), existing_file());
|
assert!(p.bin("caller2").is_file());
|
||||||
|
|
||||||
// Build caller1. should build the dep library. Because the features
|
// Build caller1. should build the dep library. Because the features
|
||||||
// are different than the full workspace, it rebuilds.
|
// are different than the full workspace, it rebuilds.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user