mirror of
https://github.com/rust-lang/cargo
synced 2024-10-05 15:29:45 +00:00
Declare one-line files on one line, in test projects
This commit is contained in:
parent
ab19c48358
commit
ca7d9ee292
|
@ -599,19 +599,9 @@ Caused by:
|
||||||
fn duplicate_deps() {
|
fn duplicate_deps() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("shim-bar/src/lib.rs", "pub fn a() {}")
|
||||||
"shim-bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("linux-bar/src/lib.rs", "pub fn a() {}")
|
||||||
"linux-bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -648,19 +638,9 @@ have a single canonical source path irrespective of build target.
|
||||||
fn duplicate_deps_diff_sources() {
|
fn duplicate_deps_diff_sources() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("shim-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("shim-bar/src/lib.rs", "pub fn a() {}")
|
||||||
"shim-bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("linux-bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("linux-bar/src/lib.rs", "pub fn a() {}")
|
||||||
"linux-bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -734,12 +714,7 @@ warning: unused manifest key: target.foo.bar
|
||||||
bulid = "foo"
|
bulid = "foo"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
@ -766,12 +741,7 @@ warning: unused manifest key: project.bulid
|
||||||
build = "foo"
|
build = "foo"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
@ -845,12 +815,7 @@ to use. This will be considered an error in future versions
|
||||||
#[test]
|
#[test]
|
||||||
fn invalid_toml_historically_allowed_is_warned() {
|
fn invalid_toml_historically_allowed_is_warned() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file(".cargo/config", "[bar] baz = 2")
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
[bar] baz = 2
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/main.rs", "fn main() {}")
|
.file("src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -908,12 +873,7 @@ This will be considered an error in future versions
|
||||||
fn bad_source_config1() {
|
fn bad_source_config1() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", "[source.foo]")
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
[source.foo]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -724,9 +724,7 @@ fn dont_run_examples() {
|
||||||
.file("src/lib.rs", r"")
|
.file("src/lib.rs", r"")
|
||||||
.file(
|
.file(
|
||||||
"examples/dont-run-me-i-will-fail.rs",
|
"examples/dont-run-me-i-will-fail.rs",
|
||||||
r#"
|
r#"fn main() { panic!("Examples should not be run by 'cargo test'"); }"#,
|
||||||
fn main() { panic!("Examples should not be run by 'cargo test'"); }
|
|
||||||
"#,
|
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("bench"), execs().with_status(0));
|
assert_that(p.cargo("bench"), execs().with_status(0));
|
||||||
|
@ -944,12 +942,7 @@ fn lib_with_standard_name2() {
|
||||||
doctest = false
|
doctest = false
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -1043,12 +1036,7 @@ fn bench_dylib() {
|
||||||
crate_type = ["dylib"]
|
crate_type = ["dylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn baz() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn baz() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1263,13 +1251,7 @@ fn test_a_bench() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("benches/b.rs", "#[test] fn foo() {}")
|
||||||
"benches/b.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1483,12 +1465,7 @@ fn bench_all_workspace() {
|
||||||
[workspace]
|
[workspace]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"benches/foo.rs",
|
"benches/foo.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1502,12 +1479,7 @@ fn bench_all_workspace() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/benches/bar.rs",
|
"bar/benches/bar.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1551,12 +1523,7 @@ fn bench_all_exclude() {
|
||||||
members = ["bar", "baz"]
|
members = ["bar", "baz"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file(
|
||||||
"bar/src/lib.rs",
|
"bar/src/lib.rs",
|
||||||
|
@ -1572,15 +1539,7 @@ fn bench_all_exclude() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "#[test] pub fn baz() { break_the_build(); }")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
pub fn baz() {
|
|
||||||
break_the_build();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1608,12 +1567,7 @@ fn bench_all_virtual_manifest() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/benches/bar.rs",
|
"bar/benches/bar.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1627,12 +1581,7 @@ fn bench_all_virtual_manifest() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"baz/benches/baz.rs",
|
"baz/benches/baz.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1678,12 +1627,7 @@ fn legacy_bench_name() {
|
||||||
name = "bench"
|
name = "bench"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/bench.rs",
|
"src/bench.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1723,12 +1667,7 @@ fn bench_virtual_manifest_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn foo() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/benches/bar.rs",
|
"bar/benches/bar.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1740,12 +1679,7 @@ fn bench_virtual_manifest_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"baz/benches/baz.rs",
|
"baz/benches/baz.rs",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -275,13 +275,7 @@ fn cargo_compile_duplicate_build_targets() {
|
||||||
[dependencies]
|
[dependencies]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "#![allow(warnings)] fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
#![allow(warnings)]
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -938,12 +932,7 @@ fn cargo_compile_with_filename() {
|
||||||
fn main() { println!("hello a.rs"); }
|
fn main() { println!("hello a.rs"); }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("examples/a.rs", r#"fn main() { println!("example"); }"#)
|
||||||
"examples/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("example"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1104,10 +1093,7 @@ fn compile_offline_without_maxvers_cached() {
|
||||||
|
|
||||||
Package::new("present_dep", "1.2.3")
|
Package::new("present_dep", "1.2.3")
|
||||||
.file("Cargo.toml", &basic_manifest("present_dep", "1.2.3"))
|
.file("Cargo.toml", &basic_manifest("present_dep", "1.2.3"))
|
||||||
.file(
|
.file("src/lib.rs", r#"pub fn get_version()->&'static str {"1.2.3"}"#)
|
||||||
"src/lib.rs",
|
|
||||||
r#"pub fn get_version()->&'static str {"1.2.3"}"#,
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
|
|
||||||
Package::new("present_dep", "1.2.5")
|
Package::new("present_dep", "1.2.5")
|
||||||
|
@ -1359,12 +1345,7 @@ fn compile_path_dep_then_change_version() {
|
||||||
#[test]
|
#[test]
|
||||||
fn ignores_carriage_return_in_lockfile() {
|
fn ignores_carriage_return_in_lockfile() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r"mod a; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
mod a; fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/a.rs", "")
|
.file("src/a.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -1648,12 +1629,7 @@ fn crate_library_path_env_var() {
|
||||||
#[test]
|
#[test]
|
||||||
fn build_with_fake_libc_not_loading() {
|
fn build_with_fake_libc_not_loading() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.file("libc.so.6", r#""#)
|
.file("libc.so.6", r#""#)
|
||||||
.build();
|
.build();
|
||||||
|
@ -1683,12 +1659,7 @@ fn many_crate_types_old_style_lib_location() {
|
||||||
crate_type = ["rlib", "dylib"]
|
crate_type = ["rlib", "dylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/foo.rs", "pub fn foo() {}")
|
||||||
"src/foo.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
@ -1722,12 +1693,7 @@ fn many_crate_types_correct() {
|
||||||
crate_type = ["rlib", "dylib"]
|
crate_type = ["rlib", "dylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
|
||||||
|
@ -2250,12 +2216,7 @@ fn release_build_ndebug() {
|
||||||
#[test]
|
#[test]
|
||||||
fn inferred_main_bin() {
|
fn inferred_main_bin() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
@ -2277,13 +2238,7 @@ fn deletion_causes_failure() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file("bar/src/lib.rs", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
@ -2296,12 +2251,7 @@ fn deletion_causes_failure() {
|
||||||
#[test]
|
#[test]
|
||||||
fn bad_cargo_toml_in_target_dir() {
|
fn bad_cargo_toml_in_target_dir() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("target/Cargo.toml", "bad-toml")
|
.file("target/Cargo.toml", "bad-toml")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -2313,19 +2263,8 @@ fn bad_cargo_toml_in_target_dir() {
|
||||||
fn lib_with_standard_name() {
|
fn lib_with_standard_name() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_manifest("syntax", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("syntax", "0.0.1"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
.file("src/main.rs", "extern crate syntax; fn main() { syntax::foo() }")
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/main.rs",
|
|
||||||
"
|
|
||||||
extern crate syntax;
|
|
||||||
fn main() { syntax::foo() }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -2383,15 +2322,7 @@ fn staticlib_rlib_and_bin() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "pub fn foo() {}")
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; fn main() { foo::foo(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
foo::foo();
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
|
@ -2605,12 +2536,7 @@ fn bad_cargo_config() {
|
||||||
let foo = project()
|
let foo = project()
|
||||||
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
|
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", "this is not valid toml")
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
this is not valid toml
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
foo.cargo("build").arg("-v"),
|
foo.cargo("build").arg("-v"),
|
||||||
|
@ -2625,7 +2551,7 @@ Caused by:
|
||||||
could not parse input as TOML
|
could not parse input as TOML
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
expected an equals, found an identifier at line 2
|
expected an equals, found an identifier at line 1
|
||||||
",
|
",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -2655,28 +2581,9 @@ fn cargo_platform_specific_dependency() {
|
||||||
host = host
|
host = host
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate dep; fn main() { dep::dep() }")
|
||||||
"src/main.rs",
|
.file("tests/foo.rs", "extern crate dev; #[test] fn foo() { dev::dev() }")
|
||||||
r#"
|
.file("build.rs", "extern crate build; fn main() { build::build(); }")
|
||||||
extern crate dep;
|
|
||||||
fn main() { dep::dep() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/foo.rs",
|
|
||||||
r#"
|
|
||||||
extern crate dev;
|
|
||||||
#[test]
|
|
||||||
fn foo() { dev::dev() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
extern crate build;
|
|
||||||
fn main() { build::build(); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("dep/Cargo.toml", &basic_manifest("dep", "0.5.0"))
|
.file("dep/Cargo.toml", &basic_manifest("dep", "0.5.0"))
|
||||||
.file("dep/src/lib.rs", "pub fn dep() {}")
|
.file("dep/src/lib.rs", "pub fn dep() {}")
|
||||||
.file("build/Cargo.toml", &basic_manifest("build", "0.5.0"))
|
.file("build/Cargo.toml", &basic_manifest("build", "0.5.0"))
|
||||||
|
@ -2709,16 +2616,7 @@ fn bad_platform_specific_dependency() {
|
||||||
)
|
)
|
||||||
.file("src/main.rs", &main_file(r#""{}", bar::gimme()"#, &["bar"]))
|
.file("src/main.rs", &main_file(r#""{}", bar::gimme()"#, &["bar"]))
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", r#"extern crate baz; pub fn gimme() -> String { format!("") }"#)
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate baz;
|
|
||||||
|
|
||||||
pub fn gimme() -> String {
|
|
||||||
format!("")
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(101));
|
assert_that(p.cargo("build"), execs().with_status(101));
|
||||||
|
@ -2740,19 +2638,9 @@ fn cargo_platform_specific_dependency_wrong_platform() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "invalid rust file, should not be compiled")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
invalid rust file, should not be compiled
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").exec_with_output().unwrap();
|
p.cargo("build").exec_with_output().unwrap();
|
||||||
|
@ -3821,19 +3709,9 @@ fn build_all_workspace() {
|
||||||
[workspace]
|
[workspace]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3860,28 +3738,11 @@ fn build_all_exclude() {
|
||||||
members = ["bar", "baz"]
|
members = ["bar", "baz"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() { break_the_build(); }")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {
|
|
||||||
break_the_build();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3952,19 +3813,9 @@ fn build_all_virtual_manifest() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// The order in which bar and baz are built is not guaranteed
|
// The order in which bar and baz are built is not guaranteed
|
||||||
|
@ -3993,19 +3844,9 @@ fn build_virtual_manifest_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// The order in which bar and baz are built is not guaranteed
|
// The order in which bar and baz are built is not guaranteed
|
||||||
|
@ -4034,19 +3875,9 @@ fn build_virtual_manifest_one_project() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file( "bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file( "baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -4130,12 +3961,7 @@ fn build_all_member_dependency_same_name() {
|
||||||
a = "0.1.0"
|
a = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("a/src/lib.rs", "pub fn a() {}")
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Package::new("a", "0.1.0").publish();
|
Package::new("a", "0.1.0").publish();
|
||||||
|
@ -4169,21 +3995,8 @@ fn run_proper_binary() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/bin/main.rs", r#"fn main() { panic!("This should never be run."); }"#)
|
||||||
"src/bin/main.rs",
|
.file("src/bin/other.rs", "fn main() {}")
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
panic!("This should never be run.");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/other.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -4197,13 +4010,7 @@ fn run_proper_binary_main_rs() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/bin/main.rs", "fn main() {}")
|
||||||
"src/bin/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -4228,22 +4035,8 @@ fn run_proper_alias_binary_from_src() {
|
||||||
name = "bar"
|
name = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/foo.rs", r#"fn main() { println!("foo"); }"#)
|
||||||
"src/foo.rs",
|
.file("src/bar.rs", r#"fn main() { println!("bar"); }"#)
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bar.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("bar");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("--all"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("--all"), execs().with_status(0));
|
||||||
|
@ -4273,14 +4066,7 @@ fn run_proper_alias_binary_main_rs() {
|
||||||
name = "bar"
|
name = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("main"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("main");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("--all"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("--all"), execs().with_status(0));
|
||||||
|
@ -4298,21 +4084,8 @@ fn run_proper_alias_binary_main_rs() {
|
||||||
fn run_proper_binary_main_rs_as_foo() {
|
fn run_proper_binary_main_rs_as_foo() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/foo.rs", r#" fn main() { panic!("This should never be run."); }"#)
|
||||||
"src/foo.rs",
|
.file("src/main.rs", "fn main() {}")
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
panic!("This should never be run.");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -4448,12 +4221,7 @@ fn deterministic_cfg_flags() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -22,12 +22,7 @@ fn verbose_output_for_lib(p: &Project) -> String {
|
||||||
#[test]
|
#[test]
|
||||||
fn build_lib_only() {
|
fn build_lib_only() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -43,12 +38,7 @@ fn build_lib_only() {
|
||||||
fn build_with_no_lib() {
|
fn build_with_no_lib() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -76,12 +66,7 @@ fn build_with_relative_cargo_home_path() {
|
||||||
"test-dependency" = { path = "src/test_dependency" }
|
"test-dependency" = { path = "src/test_dependency" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/test_dependency/src/lib.rs", r#" "#)
|
.file("src/test_dependency/src/lib.rs", r#" "#)
|
||||||
.file("src/test_dependency/Cargo.toml", &basic_manifest("test-dependency", "0.0.1"))
|
.file("src/test_dependency/Cargo.toml", &basic_manifest("test-dependency", "0.0.1"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -27,20 +27,8 @@ fn custom_build_script_failed() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
.file("build.rs", "fn main() { std::process::exit(101); }")
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
std::process::exit(101);
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build").arg("-v"),
|
p.cargo("build").arg("-v"),
|
||||||
|
@ -75,12 +63,7 @@ fn custom_build_env_vars() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -95,12 +78,7 @@ fn custom_build_env_vars() {
|
||||||
foo = []
|
foo = []
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn hello() {}");
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn hello() {}
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
|
|
||||||
let file_content = format!(
|
let file_content = format!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -208,20 +186,8 @@ fn custom_build_script_wrong_rustc_flags() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-flags=-aaa -bbb"); }"#)
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-flags=-aaa -bbb");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -249,9 +215,7 @@ fn custom_build_script_rustc_flags() {
|
||||||
[dependencies.foo]
|
[dependencies.foo]
|
||||||
path = "foo"
|
path = "foo"
|
||||||
"#)
|
"#)
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", "fn main() {}")
|
||||||
fn main() {}
|
|
||||||
"#)
|
|
||||||
.file("foo/Cargo.toml", r#"
|
.file("foo/Cargo.toml", r#"
|
||||||
[project]
|
[project]
|
||||||
|
|
||||||
|
@ -608,12 +572,7 @@ fn only_rerun_build_script() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
|
@ -717,12 +676,7 @@ fn testing_and_such() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
println!("build");
|
println!("build");
|
||||||
|
@ -811,14 +765,7 @@ fn propagation_of_l_flags() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("a/src/lib.rs", "")
|
.file("a/src/lib.rs", "")
|
||||||
.file(
|
.file("a/build.rs", r#"fn main() { println!("cargo:rustc-flags=-L bar"); }"#)
|
||||||
"a/build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-flags=-L bar");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"b/Cargo.toml",
|
"b/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1561,13 +1508,7 @@ fn build_script_with_dynamic_native_dependency() {
|
||||||
plugin = true
|
plugin = true
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[no_mangle] pub extern fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let foo = project().at("ws/foo")
|
let foo = project().at("ws/foo")
|
||||||
|
@ -1584,13 +1525,7 @@ fn build_script_with_dynamic_native_dependency() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", "extern crate bar; fn main() { bar::bar() }")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
|
@ -1723,13 +1658,7 @@ fn build_script_with_lto() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
}
|
}
|
||||||
|
@ -1787,21 +1716,8 @@ fn cfg_feedback() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "#[cfg(foo)] fn main() {}")
|
||||||
"src/main.rs",
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-cfg=foo"); }"#)
|
||||||
"
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn main() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-cfg=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
}
|
}
|
||||||
|
@ -1822,13 +1738,7 @@ fn cfg_override() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "#[cfg(foo)] fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
"
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn main() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("build.rs", "")
|
.file("build.rs", "")
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
|
@ -1858,14 +1768,7 @@ fn cfg_test() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-cfg=foo"); }"#)
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-cfg=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1888,14 +1791,7 @@ fn cfg_test() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
|
||||||
"tests/test.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(foo)]
|
|
||||||
#[test]
|
|
||||||
fn test_bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("test").arg("-v"),
|
p.cargo("test").arg("-v"),
|
||||||
|
@ -1937,21 +1833,8 @@ fn cfg_doc() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-cfg=foo"); }"#)
|
||||||
"build.rs",
|
.file("src/lib.rs", "#[cfg(foo)] pub fn foo() {}")
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-cfg=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(foo)]
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1962,21 +1845,8 @@ fn cfg_doc() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/build.rs", r#"fn main() { println!("cargo:rustc-cfg=bar"); }"#)
|
||||||
"bar/build.rs",
|
.file("bar/src/lib.rs", "#[cfg(bar)] pub fn bar() {}")
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-cfg=bar");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(bar)]
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("doc"), execs().with_status(0));
|
assert_that(p.cargo("doc"), execs().with_status(0));
|
||||||
assert_that(&p.root().join("target/doc"), existing_dir());
|
assert_that(&p.root().join("target/doc"), existing_dir());
|
||||||
|
@ -2037,14 +1907,7 @@ fn cfg_override_test() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("tests/test.rs", "#[cfg(foo)] #[test] fn test_bar() {}")
|
||||||
"tests/test.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(foo)]
|
|
||||||
#[test]
|
|
||||||
fn test_bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("test").arg("-v"),
|
p.cargo("test").arg("-v"),
|
||||||
|
@ -2098,13 +1961,7 @@ fn cfg_override_doc() {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file("build.rs", "")
|
.file("build.rs", "")
|
||||||
.file(
|
.file("src/lib.rs", "#[cfg(foo)] pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(foo)]
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -2117,13 +1974,7 @@ fn cfg_override_doc() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/build.rs", "")
|
.file("bar/build.rs", "")
|
||||||
.file(
|
.file("bar/src/lib.rs", "#[cfg(bar)] pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(bar)]
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("doc"), execs().with_status(0));
|
assert_that(p.cargo("doc"), execs().with_status(0));
|
||||||
assert_that(&p.root().join("target/doc"), existing_dir());
|
assert_that(&p.root().join("target/doc"), existing_dir());
|
||||||
|
@ -2159,14 +2010,7 @@ fn env_build() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#)
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-env=FOO=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -2188,20 +2032,8 @@ fn env_test() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#)
|
||||||
"build.rs",
|
.file("src/lib.rs", r#"pub const FOO: &'static str = env!("FOO"); "#)
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-env=FOO=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub const FOO: &'static str = env!("FOO");
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"tests/test.rs",
|
"tests/test.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -2257,13 +2089,7 @@ fn env_doc() {
|
||||||
fn main() {}
|
fn main() {}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", r#"fn main() { println!("cargo:rustc-env=FOO=foo"); }"#,
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-env=FOO=foo");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("doc").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("doc").arg("-v"), execs().with_status(0));
|
||||||
|
@ -2931,13 +2757,7 @@ fn non_utf8_output() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "#[cfg(foo)] fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(foo)]
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
|
@ -3588,12 +3408,7 @@ fn deterministic_rustc_dependency_flags() {
|
||||||
dep4 = "*"
|
dep4 = "*"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3687,13 +3502,7 @@ fn rename_with_link_search_path() {
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[no_mangle] pub extern fn cargo_test_foo() {}");
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn cargo_test_foo() {}
|
|
||||||
",
|
|
||||||
);
|
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
@ -3851,12 +3660,7 @@ fn optional_build_script_dep() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() -> u32 { 1 }");
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() -> u32 { 1 }
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
assert_that(p.cargo("run"), execs().with_status(0).with_stdout("0\n"));
|
assert_that(p.cargo("run"), execs().with_status(0).with_stdout("0\n"));
|
||||||
|
@ -3885,13 +3689,7 @@ fn optional_build_dep_and_required_normal_dep() {
|
||||||
bar = { path = "./bar" }
|
bar = { path = "./bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("build.rs", "extern crate bar; fn main() { bar::bar(); }")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar(); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -3909,12 +3707,7 @@ fn optional_build_dep_and_required_normal_dep() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() -> u32 { 1 }");
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() -> u32 { 1 }
|
|
||||||
"#,
|
|
||||||
);
|
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -7,12 +7,7 @@ use support::hamcrest::assert_that;
|
||||||
#[test]
|
#[test]
|
||||||
fn rerun_if_env_changes() {
|
fn rerun_if_env_changes() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"build.rs",
|
"build.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -68,12 +63,7 @@ fn rerun_if_env_changes() {
|
||||||
#[test]
|
#[test]
|
||||||
fn rerun_if_env_or_file_changes() {
|
fn rerun_if_env_or_file_changes() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"build.rs",
|
"build.rs",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -5,12 +5,7 @@ use support::hamcrest::assert_that;
|
||||||
fn alias_incorrect_config_type() {
|
fn alias_incorrect_config_type() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -34,12 +29,7 @@ expected a list, but found a integer for [..]",
|
||||||
fn alias_default_config_overrides_config() {
|
fn alias_default_config_overrides_config() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -61,12 +51,7 @@ fn alias_default_config_overrides_config() {
|
||||||
fn alias_config() {
|
fn alias_config() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -92,12 +77,7 @@ fn alias_config() {
|
||||||
fn recursive_alias() {
|
fn recursive_alias() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", r"fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -122,12 +102,7 @@ fn recursive_alias() {
|
||||||
fn alias_list_test() {
|
fn alias_list_test() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -150,12 +125,7 @@ fn alias_list_test() {
|
||||||
fn alias_with_flags_config() {
|
fn alias_with_flags_config() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -178,12 +148,7 @@ fn alias_with_flags_config() {
|
||||||
fn cant_shadow_builtin() {
|
fn cant_shadow_builtin() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -220,10 +220,7 @@ fn works_through_the_registry() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate bar;")
|
||||||
"src/lib.rs",
|
|
||||||
"#[allow(unused_extern_crates)] extern crate bar;",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -268,10 +265,7 @@ fn ignore_version_from_other_platform() {
|
||||||
this_family, other_family
|
this_family, other_family
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate bar;")
|
||||||
"src/lib.rs",
|
|
||||||
"#[allow(unused_extern_crates)] extern crate bar;",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -21,24 +21,11 @@ fn check_success() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::baz(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::baz();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(foo.cargo("check"), execs().with_status(0));
|
assert_that(foo.cargo("check"), execs().with_status(0));
|
||||||
|
@ -59,24 +46,11 @@ fn check_fail() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::baz(42); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::baz(42);
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(foo.cargo("check"), execs().with_status(101));
|
assert_that(foo.cargo("check"), execs().with_status(101));
|
||||||
|
@ -162,25 +136,12 @@ fn check_build() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::baz(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::baz();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(foo.cargo("check"), execs().with_status(0));
|
assert_that(foo.cargo("check"), execs().with_status(0));
|
||||||
|
@ -202,25 +163,12 @@ fn build_check() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::baz(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::baz();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(foo.cargo("build"), execs().with_status(0));
|
assert_that(foo.cargo("build"), execs().with_status(0));
|
||||||
|
@ -363,24 +311,11 @@ fn rustc_check() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::baz(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::baz();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -408,24 +343,11 @@ fn rustc_check_err() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { ::bar::qux(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
::bar::qux();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -485,19 +407,9 @@ fn check_virtual_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -234,10 +234,7 @@ fn git_same_repo_different_tags() {
|
||||||
a.url()
|
a.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("a/src/main.rs", "extern crate dep; fn main() { dep::tag1(); }")
|
||||||
"a/src/main.rs",
|
|
||||||
"extern crate dep; fn main() { dep::tag1(); }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"b/Cargo.toml",
|
"b/Cargo.toml",
|
||||||
&format!(
|
&format!(
|
||||||
|
@ -253,10 +250,7 @@ fn git_same_repo_different_tags() {
|
||||||
a.url()
|
a.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("b/src/main.rs", "extern crate dep; fn main() { dep::tag2(); }");
|
||||||
"b/src/main.rs",
|
|
||||||
"extern crate dep; fn main() { dep::tag2(); }",
|
|
||||||
);
|
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
let mut a = p.cargo("build")
|
let mut a = p.cargo("build")
|
||||||
|
@ -306,10 +300,7 @@ fn git_same_branch_different_revs() {
|
||||||
a.url()
|
a.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("a/src/main.rs", "extern crate dep; fn main() { dep::f1(); }")
|
||||||
"a/src/main.rs",
|
|
||||||
"extern crate dep; fn main() { dep::f1(); }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"b/Cargo.toml",
|
"b/Cargo.toml",
|
||||||
&format!(
|
&format!(
|
||||||
|
@ -325,10 +316,7 @@ fn git_same_branch_different_revs() {
|
||||||
a.url()
|
a.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("b/src/main.rs", "extern crate dep; fn main() { dep::f2(); }");
|
||||||
"b/src/main.rs",
|
|
||||||
"extern crate dep; fn main() { dep::f2(); }",
|
|
||||||
);
|
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
||||||
// Generate a Cargo.lock pointing at the current rev, then clear out the
|
// Generate a Cargo.lock pointing at the current rev, then clear out the
|
||||||
|
|
|
@ -139,13 +139,7 @@ fn simple_deps() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::bar(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar(); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _p2 = project().at("bar")
|
let _p2 = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
|
@ -787,12 +781,7 @@ fn build_script_needed_for_host_and_target() {
|
||||||
build = 'build.rs'
|
build = 'build.rs'
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("d1/src/lib.rs", "pub fn d1() {}")
|
||||||
"d1/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn d1() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"d1/build.rs",
|
"d1/build.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -889,12 +878,7 @@ fn build_deps_for_the_right_arch() {
|
||||||
)
|
)
|
||||||
.file("src/main.rs", "extern crate d2; fn main() {}")
|
.file("src/main.rs", "extern crate d2; fn main() {}")
|
||||||
.file("d1/Cargo.toml", &basic_manifest("d1", "0.0.0"))
|
.file("d1/Cargo.toml", &basic_manifest("d1", "0.0.0"))
|
||||||
.file(
|
.file("d1/src/lib.rs", "pub fn d1() {}")
|
||||||
"d1/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn d1() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"d2/Cargo.toml",
|
"d2/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -951,12 +935,7 @@ fn build_script_only_host() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("d1/src/lib.rs", "pub fn d1() {}")
|
||||||
"d1/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn d1() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"d1/build.rs",
|
"d1/build.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1065,13 +1044,7 @@ fn build_script_with_platform_specific_dependencies() {
|
||||||
host
|
host
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("d1/src/lib.rs", "#[allow(unused_extern_crates)] extern crate d2;")
|
||||||
"d1/src/lib.rs",
|
|
||||||
"
|
|
||||||
#[allow(unused_extern_crates)]
|
|
||||||
extern crate d2;
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("d2/Cargo.toml", &basic_manifest("d2", "0.0.0"))
|
.file("d2/Cargo.toml", &basic_manifest("d2", "0.0.0"))
|
||||||
.file("d2/src/lib.rs", "")
|
.file("d2/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
@ -1216,12 +1189,7 @@ fn platform_specific_variables_reflected_in_build_scripts() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("d1/build.rs", r#"fn main() { println!("cargo:val=1") }"#)
|
||||||
"d1/build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("cargo:val=1") }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("d1/src/lib.rs", "")
|
.file("d1/src/lib.rs", "")
|
||||||
.file(
|
.file(
|
||||||
"d2/Cargo.toml",
|
"d2/Cargo.toml",
|
||||||
|
@ -1234,12 +1202,7 @@ fn platform_specific_variables_reflected_in_build_scripts() {
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("d2/build.rs", r#"fn main() { println!("cargo:val=1") }"#)
|
||||||
"d2/build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("cargo:val=1") }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("d2/src/lib.rs", "")
|
.file("d2/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -95,16 +95,7 @@ fn simple() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -140,16 +131,7 @@ fn simple_install() {
|
||||||
foo = "0.0.1"
|
foo = "0.0.1"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; pub fn main() { foo::foo(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
foo::foo();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -188,16 +170,7 @@ fn simple_install_fail() {
|
||||||
baz = "9.8.7"
|
baz = "9.8.7"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; pub fn main() { foo::foo(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
foo::foo();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -241,16 +214,7 @@ fn install_without_feature_dep() {
|
||||||
wantbaz = ["baz"]
|
wantbaz = ["baz"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; pub fn main() { foo::foo(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
foo::foo();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -286,16 +250,7 @@ fn not_there() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -339,16 +294,7 @@ fn multiple() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -378,16 +324,7 @@ fn crates_io_then_directory() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let cksum = Package::new("bar", "0.1.0")
|
let cksum = Package::new("bar", "0.1.0")
|
||||||
|
|
|
@ -25,12 +25,7 @@ fn simple() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("build.rs", "fn main() {}")
|
.file("build.rs", "fn main() {}")
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -64,12 +59,7 @@ fn doc_no_libs() {
|
||||||
doc = false
|
doc = false
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "bad code")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
bad code
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("doc"), execs().with_status(0));
|
assert_that(p.cargo("doc"), execs().with_status(0));
|
||||||
|
@ -78,12 +68,7 @@ fn doc_no_libs() {
|
||||||
#[test]
|
#[test]
|
||||||
fn doc_twice() {
|
fn doc_twice() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -115,20 +100,9 @@ fn doc_deps() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -188,20 +162,9 @@ fn doc_no_deps() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -239,20 +202,9 @@ fn doc_only_bin() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; pub fn foo() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("doc").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("doc").arg("-v"), execs().with_status(0));
|
||||||
|
@ -833,12 +785,7 @@ fn no_document_build_deps() {
|
||||||
a = { path = "a" }
|
a = { path = "a" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("a/Cargo.toml", &basic_manifest("a", "0.0.1"))
|
.file("a/Cargo.toml", &basic_manifest("a", "0.0.1"))
|
||||||
.file(
|
.file(
|
||||||
"a/src/lib.rs",
|
"a/src/lib.rs",
|
||||||
|
@ -891,27 +838,11 @@ fn doc_multiple_deps() {
|
||||||
path = "baz"
|
path = "baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -947,13 +878,7 @@ fn features() {
|
||||||
foo = ["bar/bar"]
|
foo = ["bar/bar"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", r#"#[cfg(feature = "foo")] pub fn foo() {}"#)
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "foo")]
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -974,13 +899,7 @@ fn features() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", r#"#[cfg(feature = "bar")] pub fn bar() {}"#)
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "bar")]
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("doc").arg("--features").arg("foo"),
|
p.cargo("doc").arg("--features").arg("foo"),
|
||||||
|
@ -1087,19 +1006,9 @@ fn doc_all_workspace() {
|
||||||
[workspace]
|
[workspace]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// The order in which bar is compiled or documented is not deterministic
|
// The order in which bar is compiled or documented is not deterministic
|
||||||
|
@ -1124,19 +1033,9 @@ fn doc_all_virtual_manifest() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// The order in which bar and baz are documented is not guaranteed
|
// The order in which bar and baz are documented is not guaranteed
|
||||||
|
@ -1160,19 +1059,9 @@ fn doc_virtual_manifest_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "pub fn baz() {}")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// The order in which bar and baz are documented is not guaranteed
|
// The order in which bar and baz are documented is not guaranteed
|
||||||
|
@ -1210,12 +1099,7 @@ fn doc_all_member_dependency_same_name() {
|
||||||
bar = "0.1.0"
|
bar = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Package::new("bar", "0.1.0").publish();
|
Package::new("bar", "0.1.0").publish();
|
||||||
|
|
|
@ -389,13 +389,7 @@ fn no_transitive_dep_feature_requirement() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("derived/src/lib.rs", "extern crate bar; pub use bar::test;")
|
||||||
"derived/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub use bar::test;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -887,13 +881,7 @@ fn transitive_features() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::baz(); }")
|
||||||
"src/main.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::baz(); }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -906,13 +894,7 @@ fn transitive_features() {
|
||||||
baz = []
|
baz = []
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", r#"#[cfg(feature = "baz")] pub fn baz() {}"#)
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "baz")]
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1065,13 +1047,7 @@ fn unions_work_with_no_default_features() {
|
||||||
b = { path = "b" }
|
b = { path = "b" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate a; pub fn foo() { a::a(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate a;
|
|
||||||
pub fn foo() { a::a(); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"b/Cargo.toml",
|
"b/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1098,13 +1074,7 @@ fn unions_work_with_no_default_features() {
|
||||||
f1 = []
|
f1 = []
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("a/src/lib.rs", r#"#[cfg(feature = "f1")] pub fn a() {}"#)
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "f1")]
|
|
||||||
pub fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
@ -1163,15 +1133,7 @@ fn activating_feature_activates_dep() {
|
||||||
a = ["foo/a"]
|
a = ["foo/a"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate foo; pub fn bar() { foo::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate foo;
|
|
||||||
pub fn bar() {
|
|
||||||
foo::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"foo/Cargo.toml",
|
"foo/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1184,13 +1146,7 @@ fn activating_feature_activates_dep() {
|
||||||
a = []
|
a = []
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("foo/src/lib.rs", r#"#[cfg(feature = "a")] pub fn bar() {}"#)
|
||||||
"foo/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "a")]
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1237,13 +1193,7 @@ fn dep_feature_in_cmd_line() {
|
||||||
derived-feat = ["bar/some-feat"]
|
derived-feat = ["bar/some-feat"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("derived/src/lib.rs", "extern crate bar; pub use bar::test;")
|
||||||
"derived/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub use bar::test;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -6,12 +6,7 @@ use support::hamcrest::assert_that;
|
||||||
#[test]
|
#[test]
|
||||||
fn no_deps() {
|
fn no_deps() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "mod a; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
mod a; fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/a.rs", "")
|
.file("src/a.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -657,10 +657,7 @@ fn fix_two_files() {
|
||||||
#[test]
|
#[test]
|
||||||
fn fixes_missing_ampersand() {
|
fn fixes_missing_ampersand() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() { let mut x = 3; drop(x); }")
|
||||||
"src/main.rs",
|
|
||||||
"fn main() { let mut x = 3; drop(x); }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/lib.rs",
|
"src/lib.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -677,18 +674,8 @@ fn fixes_missing_ampersand() {
|
||||||
pub fn foo() { let mut x = 3; drop(x); }
|
pub fn foo() { let mut x = 3; drop(x); }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("examples/foo.rs", "fn main() { let mut x = 3; drop(x); }")
|
||||||
"examples/foo.rs",
|
.file("build.rs", "fn main() { let mut x = 3; drop(x); }")
|
||||||
r#"
|
|
||||||
fn main() { let mut x = 3; drop(x); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { let mut x = 3; drop(x); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -748,15 +735,7 @@ fn fix_features() {
|
||||||
#[test]
|
#[test]
|
||||||
fn shows_warnings() {
|
fn shows_warnings() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "use std::default::Default; pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
use std::default::Default;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -769,13 +748,7 @@ fn shows_warnings() {
|
||||||
fn warns_if_no_vcs_detected() {
|
fn warns_if_no_vcs_detected() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.use_temp_dir()
|
.use_temp_dir()
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -796,13 +769,7 @@ destructive changes; if you'd like to suppress this error pass `--allow-no-vcs`\
|
||||||
#[test]
|
#[test]
|
||||||
fn warns_about_dirty_working_directory() {
|
fn warns_about_dirty_working_directory() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let repo = git2::Repository::init(&p.root()).unwrap();
|
let repo = git2::Repository::init(&p.root()).unwrap();
|
||||||
|
@ -838,13 +805,7 @@ these files:
|
||||||
#[test]
|
#[test]
|
||||||
fn does_not_warn_about_clean_working_directory() {
|
fn does_not_warn_about_clean_working_directory() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let repo = git2::Repository::init(&p.root()).unwrap();
|
let repo = git2::Repository::init(&p.root()).unwrap();
|
||||||
|
@ -864,13 +825,7 @@ fn does_not_warn_about_clean_working_directory() {
|
||||||
#[test]
|
#[test]
|
||||||
fn does_not_warn_about_dirty_ignored_files() {
|
fn does_not_warn_about_dirty_ignored_files() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn foo() {
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(".gitignore", "foo\n")
|
.file(".gitignore", "foo\n")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,7 @@ use support::hamcrest::{assert_that, existing_file};
|
||||||
#[test]
|
#[test]
|
||||||
fn modifying_and_moving() {
|
fn modifying_and_moving() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "mod a; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
mod a; fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/a.rs", "")
|
.file("src/a.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -58,13 +53,7 @@ fn modify_only_some_files() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", "mod a;")
|
.file("src/lib.rs", "mod a;")
|
||||||
.file("src/a.rs", "")
|
.file("src/a.rs", "")
|
||||||
.file(
|
.file("src/main.rs", "mod b; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
mod b;
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/b.rs", "")
|
.file("src/b.rs", "")
|
||||||
.file("tests/test.rs", "")
|
.file("tests/test.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -48,10 +48,7 @@ fn cargo_compile_simple_git_dep() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/main.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let root = project.root();
|
let root = project.root();
|
||||||
|
@ -297,10 +294,7 @@ fn cargo_compile_git_dep_branch() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/main.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let root = project.root();
|
let root = project.root();
|
||||||
|
@ -373,10 +367,7 @@ fn cargo_compile_git_dep_tag() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/main.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let root = project.root();
|
let root = project.root();
|
||||||
|
@ -472,10 +463,7 @@ fn cargo_compile_with_nested_paths() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/foo.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/foo.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").exec_with_output().unwrap();
|
p.cargo("build").exec_with_output().unwrap();
|
||||||
|
@ -501,12 +489,7 @@ fn cargo_compile_with_malformed_nested_paths() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("vendor/dep2/Cargo.toml", "!INVALID!")
|
||||||
"vendor/dep2/Cargo.toml",
|
|
||||||
r#"
|
|
||||||
!INVALID!
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
@ -532,10 +515,7 @@ fn cargo_compile_with_malformed_nested_paths() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/foo.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/foo.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build").exec_with_output().unwrap();
|
p.cargo("build").exec_with_output().unwrap();
|
||||||
|
@ -646,10 +626,7 @@ fn cargo_compile_with_short_ssh_git() {
|
||||||
url
|
url
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/foo.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/foo.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -761,12 +738,7 @@ fn recompilation() {
|
||||||
let git_project = git::new("bar", |project| {
|
let git_project = git::new("bar", |project| {
|
||||||
project
|
project
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
||||||
.file(
|
.file("src/bar.rs", "pub fn bar() {}")
|
||||||
"src/bar.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
@ -885,12 +857,7 @@ fn update_with_shared_deps() {
|
||||||
let git_project = git::new("bar", |project| {
|
let git_project = git::new("bar", |project| {
|
||||||
project
|
project
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
||||||
.file(
|
.file("src/bar.rs", "pub fn bar() {}")
|
||||||
"src/bar.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
@ -1094,13 +1061,7 @@ fn dep_with_submodule() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate dep1; pub fn foo() { dep1::dep() }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate dep1;
|
|
||||||
pub fn foo() { dep1::dep() }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1165,13 +1126,7 @@ fn dep_with_bad_submodule() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate dep1; pub fn foo() { dep1::dep() }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate dep1;
|
|
||||||
pub fn foo() { dep1::dep() }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let expected = format!(
|
let expected = format!(
|
||||||
|
@ -1577,12 +1532,7 @@ fn git_build_cmd_freshness() {
|
||||||
)
|
)
|
||||||
.file("build.rs", "fn main() {}")
|
.file("build.rs", "fn main() {}")
|
||||||
.file("src/lib.rs", "pub fn bar() -> i32 { 1 }")
|
.file("src/lib.rs", "pub fn bar() -> i32 { 1 }")
|
||||||
.file(
|
.file(".gitignore", "src/bar.rs")
|
||||||
".gitignore",
|
|
||||||
"
|
|
||||||
src/bar.rs
|
|
||||||
",
|
|
||||||
)
|
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
foo.root().move_into_the_past();
|
foo.root().move_into_the_past();
|
||||||
|
|
||||||
|
@ -2608,13 +2558,7 @@ fn include_overrides_gitignore() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "mod not_incl; mod incl;")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
mod not_incl;
|
|
||||||
mod incl;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/mod.md",
|
"src/mod.md",
|
||||||
r#"
|
r#"
|
||||||
|
@ -2745,10 +2689,7 @@ fn invalid_git_dependency_manifest() {
|
||||||
git_project.url()
|
git_project.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", &main_file(r#""{}", dep1::hello()"#, &["dep1"]))
|
||||||
"src/main.rs",
|
|
||||||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let git_root = git_project.root();
|
let git_root = git_project.root();
|
||||||
|
|
|
@ -22,16 +22,7 @@ fn cargo_process(s: &str) -> ProcessBuilder {
|
||||||
fn pkg(name: &str, vers: &str) {
|
fn pkg(name: &str, vers: &str) {
|
||||||
Package::new(name, vers)
|
Package::new(name, vers)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/main.rs", &format!("extern crate {}; fn main() {{}}", name))
|
||||||
"src/main.rs",
|
|
||||||
&format!(
|
|
||||||
"
|
|
||||||
extern crate {};
|
|
||||||
fn main() {{}}
|
|
||||||
",
|
|
||||||
name
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,14 +813,7 @@ fn uninstall_piecemeal() {
|
||||||
#[test]
|
#[test]
|
||||||
fn subcommand_works_out_of_the_box() {
|
fn subcommand_works_out_of_the_box() {
|
||||||
Package::new("cargo-foo", "1.0.0")
|
Package::new("cargo-foo", "1.0.0")
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("bar"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
println!("bar");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
assert_that(
|
assert_that(
|
||||||
cargo_process("install").arg("cargo-foo"),
|
cargo_process("install").arg("cargo-foo"),
|
||||||
|
@ -926,14 +910,7 @@ warning: be sure to add `[..]` to your PATH to be able to run the installed bina
|
||||||
#[test]
|
#[test]
|
||||||
fn reports_unsuccessful_subcommand_result() {
|
fn reports_unsuccessful_subcommand_result() {
|
||||||
Package::new("cargo-fail", "1.0.0")
|
Package::new("cargo-fail", "1.0.0")
|
||||||
.file(
|
.file("src/main.rs", "fn main() { panic!(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
panic!();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
assert_that(
|
assert_that(
|
||||||
cargo_process("install").arg("cargo-fail"),
|
cargo_process("install").arg("cargo-fail"),
|
||||||
|
@ -1292,14 +1269,7 @@ fn install_respects_lock_file() {
|
||||||
Package::new("foo", "0.1.0")
|
Package::new("foo", "0.1.0")
|
||||||
.dep("bar", "0.1")
|
.dep("bar", "0.1")
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; extern crate bar; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
"
|
|
||||||
extern crate foo;
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"Cargo.lock",
|
"Cargo.lock",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1328,14 +1298,7 @@ fn lock_file_path_deps_ok() {
|
||||||
Package::new("foo", "0.1.0")
|
Package::new("foo", "0.1.0")
|
||||||
.dep("bar", "0.1")
|
.dep("bar", "0.1")
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; extern crate bar; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
"
|
|
||||||
extern crate foo;
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"Cargo.lock",
|
"Cargo.lock",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -42,15 +42,7 @@ fn simple() {
|
||||||
bar = "0.0.1"
|
bar = "0.0.1"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -94,15 +86,7 @@ fn multiple_versions() {
|
||||||
bar = "*"
|
bar = "*"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -452,15 +436,7 @@ fn crates_io_registry_url_is_optional() {
|
||||||
bar = "0.0.1"
|
bar = "0.0.1"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -32,15 +32,7 @@ fn override_simple() {
|
||||||
bar.url()
|
bar.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -243,15 +235,7 @@ fn persists_across_rebuilds() {
|
||||||
foo.url()
|
foo.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -295,15 +279,7 @@ fn replace_registry_with_path() {
|
||||||
"bar:0.1.0" = { path = "../bar" }
|
"bar:0.1.0" = { path = "../bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -327,13 +303,7 @@ fn use_a_spec_to_select() {
|
||||||
Package::new("baz", "0.2.0").publish();
|
Package::new("baz", "0.2.0").publish();
|
||||||
Package::new("bar", "0.1.1")
|
Package::new("bar", "0.1.1")
|
||||||
.dep("baz", "0.2")
|
.dep("baz", "0.2")
|
||||||
.file(
|
.file("src/lib.rs", "extern crate baz; pub fn bar() { baz::baz3(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate baz;
|
|
||||||
pub fn bar() { baz::baz3(); }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
|
|
||||||
let foo = git::repo(&paths::root().join("override"))
|
let foo = git::repo(&paths::root().join("override"))
|
||||||
|
@ -812,13 +782,7 @@ fn no_override_self() {
|
||||||
far = { path = "../far" }
|
far = { path = "../far" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("near/src/lib.rs", "#![no_std] pub extern crate far;")
|
||||||
"near/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#![no_std]
|
|
||||||
pub extern crate far;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
@ -840,13 +804,7 @@ fn no_override_self() {
|
||||||
deps.url()
|
deps.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#![no_std] pub extern crate near;")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#![no_std]
|
|
||||||
pub extern crate near;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("--verbose"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("--verbose"), execs().with_status(0));
|
||||||
|
@ -897,12 +855,7 @@ fn broken_path_override_warns() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("a2/src/lib.rs", "")
|
.file("a2/src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", r#"paths = ["a2"]"#)
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["a2"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1039,12 +992,7 @@ fn override_an_override() {
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.file("serde/Cargo.toml", &basic_manifest("serde", "0.8.0"))
|
.file("serde/Cargo.toml", &basic_manifest("serde", "0.8.0"))
|
||||||
.file(
|
.file("serde/src/lib.rs", "pub fn serde08_override() {}")
|
||||||
"serde/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn serde08_override() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
|
||||||
|
@ -1199,12 +1147,7 @@ fn override_to_path_dep() {
|
||||||
.file("bar/src/lib.rs", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.file("bar/baz/Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
.file("bar/baz/Cargo.toml", &basic_manifest("baz", "0.0.1"))
|
||||||
.file("bar/baz/src/lib.rs", "")
|
.file("bar/baz/src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", r#"paths = ["bar"]"#)
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["bar"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
@ -1244,16 +1187,7 @@ fn replace_to_path_dep() {
|
||||||
baz = { path = "baz" }
|
baz = { path = "baz" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "extern crate baz; pub fn bar() { baz::baz(); }")
|
||||||
"bar/src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate baz;
|
|
||||||
|
|
||||||
pub fn bar() {
|
|
||||||
baz::baz();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("bar/baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("bar/baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file("bar/baz/src/lib.rs", "pub fn baz() {}")
|
.file("bar/baz/src/lib.rs", "pub fn baz() {}")
|
||||||
.build();
|
.build();
|
||||||
|
@ -1305,12 +1239,7 @@ fn paths_ok_with_optional() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar2/src/lib.rs", "")
|
.file("bar2/src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", r#"paths = ["bar2"]"#)
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["bar2"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1358,12 +1287,7 @@ fn paths_add_optional_bad() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("bar2/src/lib.rs", "")
|
.file("bar2/src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", r#"paths = ["bar2"]"#)
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["bar2"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1401,16 +1325,7 @@ fn override_with_default_feature() {
|
||||||
'bar:0.1.0' = { path = "bar" }
|
'bar:0.1.0' = { path = "bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::bar(); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -23,9 +23,7 @@ fn simple() {
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "foo"
|
description = "foo"
|
||||||
"#)
|
"#)
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#)
|
|
||||||
.file("src/bar.txt", "") // should be ignored when packaging
|
.file("src/bar.txt", "") // should be ignored when packaging
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -79,12 +77,7 @@ src[/]main.rs
|
||||||
#[test]
|
#[test]
|
||||||
fn metadata_warning() {
|
fn metadata_warning() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("package"),
|
p.cargo("package"),
|
||||||
|
@ -113,12 +106,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("package"),
|
p.cargo("package"),
|
||||||
|
@ -148,12 +136,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
|
||||||
repository = "bar"
|
repository = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("package"),
|
p.cargo("package"),
|
||||||
|
@ -174,12 +157,7 @@ fn package_verbose() {
|
||||||
let root = paths::root().join("all");
|
let root = paths::root().join("all");
|
||||||
let p = git::repo(&root)
|
let p = git::repo(&root)
|
||||||
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("a/Cargo.toml", &basic_manifest("a", "0.0.1"))
|
.file("a/Cargo.toml", &basic_manifest("a", "0.0.1"))
|
||||||
.file("a/src/lib.rs", "")
|
.file("a/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
@ -223,12 +201,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
|
||||||
#[test]
|
#[test]
|
||||||
fn package_verification() {
|
fn package_verification() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -318,9 +291,7 @@ fn exclude() {
|
||||||
"dir_deep_5/**", # CHANGING (packaged -> ignored)
|
"dir_deep_5/**", # CHANGING (packaged -> ignored)
|
||||||
]
|
]
|
||||||
"#)
|
"#)
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#)
|
|
||||||
.file("bar.txt", "")
|
.file("bar.txt", "")
|
||||||
.file("src/bar.txt", "")
|
.file("src/bar.txt", "")
|
||||||
// file in root
|
// file in root
|
||||||
|
@ -434,9 +405,7 @@ fn include() {
|
||||||
include = ["foo.txt", "**/*.rs", "Cargo.toml"]
|
include = ["foo.txt", "**/*.rs", "Cargo.toml"]
|
||||||
"#)
|
"#)
|
||||||
.file("foo.txt", "")
|
.file("foo.txt", "")
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#)
|
|
||||||
.file("src/bar.txt", "") // should be ignored when packaging
|
.file("src/bar.txt", "") // should be ignored when packaging
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -458,13 +427,7 @@ See http://doc.crates.io/manifest.html#package-metadata for more info.
|
||||||
#[test]
|
#[test]
|
||||||
fn package_lib_with_bin() {
|
fn package_lib_with_bin() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "extern crate foo; fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -522,20 +485,11 @@ fn no_duplicates_from_modified_tracked_files() {
|
||||||
let root = paths::root().join("all");
|
let root = paths::root().join("all");
|
||||||
let p = git::repo(&root)
|
let p = git::repo(&root)
|
||||||
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("foo", "0.0.1"))
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
File::create(p.root().join("src/main.rs"))
|
File::create(p.root().join("src/main.rs"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.write_all(
|
.write_all(br#"fn main() { println!("A change!"); }"#)
|
||||||
br#"
|
|
||||||
fn main() { println!("A change!"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let mut cargo = cargo_process();
|
let mut cargo = cargo_process();
|
||||||
cargo.cwd(p.root());
|
cargo.cwd(p.root());
|
||||||
|
@ -624,12 +578,7 @@ src[..]main.rs
|
||||||
#[test]
|
#[test]
|
||||||
fn package_weird_characters() {
|
fn package_weird_characters() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/:foo", "")
|
.file("src/:foo", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -652,12 +601,7 @@ Caused by:
|
||||||
#[test]
|
#[test]
|
||||||
fn repackage_on_source_change() {
|
fn repackage_on_source_change() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("package"), execs().with_status(0));
|
assert_that(p.cargo("package"), execs().with_status(0));
|
||||||
|
@ -733,12 +677,7 @@ fn broken_symlink() {
|
||||||
repository = 'foo'
|
repository = 'foo'
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
t!(fs::symlink("nowhere", &p.root().join("src/foo.rs")));
|
t!(fs::symlink("nowhere", &p.root().join("src/foo.rs")));
|
||||||
|
|
||||||
|
@ -1335,9 +1274,7 @@ fn lock_file_and_workspace() {
|
||||||
#[test]
|
#[test]
|
||||||
fn do_not_package_if_src_was_modified() {
|
fn do_not_package_if_src_was_modified() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#)
|
|
||||||
.file("build.rs", r#"
|
.file("build.rs", r#"
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
|
@ -12,15 +12,7 @@ use support::hamcrest::assert_that;
|
||||||
fn replace() {
|
fn replace() {
|
||||||
Package::new("bar", "0.1.0").publish();
|
Package::new("bar", "0.1.0").publish();
|
||||||
Package::new("baz", "0.1.0")
|
Package::new("baz", "0.1.0")
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn baz() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn baz() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.dep("bar", "0.1.0")
|
.dep("bar", "0.1.0")
|
||||||
.publish();
|
.publish();
|
||||||
|
|
||||||
|
@ -53,12 +45,7 @@ fn replace() {
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -101,22 +88,9 @@ fn nonexistent() {
|
||||||
bar = { path = "bar" }
|
bar = { path = "bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -162,22 +136,9 @@ fn patch_git() {
|
||||||
bar.url()
|
bar.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -225,15 +186,7 @@ fn patch_to_git() {
|
||||||
bar.url()
|
bar.url()
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::bar(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {
|
|
||||||
bar::bar();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -276,12 +229,7 @@ fn unused() {
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.2.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.2.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "not rust code")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
not rust code
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -984,13 +932,7 @@ fn replace_prerelease() {
|
||||||
baz = "1.1.0-pre.1"
|
baz = "1.1.0-pre.1"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/main.rs", "extern crate baz; fn main() { baz::baz() }")
|
||||||
"bar/src/main.rs",
|
|
||||||
"
|
|
||||||
extern crate baz;
|
|
||||||
fn main() { baz::baz() }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"baz/Cargo.toml",
|
"baz/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -286,20 +286,9 @@ fn no_rebuild_dependency() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::bar() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
|
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
|
||||||
.file(
|
.file("bar/src/bar.rs", "pub fn bar() {}")
|
||||||
"bar/src/bar.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
// First time around we should compile both foo and bar
|
// First time around we should compile both foo and bar
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -350,13 +339,7 @@ fn deep_dependencies_trigger_rebuild() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::bar() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -372,20 +355,9 @@ fn deep_dependencies_trigger_rebuild() {
|
||||||
path = "../baz"
|
path = "../baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/bar.rs", "extern crate baz; pub fn bar() { baz::baz() }")
|
||||||
"bar/src/bar.rs",
|
|
||||||
r#"
|
|
||||||
extern crate baz;
|
|
||||||
pub fn bar() { baz::baz() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
|
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
|
||||||
.file(
|
.file("baz/src/baz.rs", "pub fn baz() {}")
|
||||||
"baz/src/baz.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
@ -471,13 +443,7 @@ fn no_rebuild_two_deps() {
|
||||||
path = "baz"
|
path = "baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::bar() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar() }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -493,19 +459,9 @@ fn no_rebuild_two_deps() {
|
||||||
path = "../baz"
|
path = "../baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/bar.rs", "pub fn bar() {}")
|
||||||
"bar/src/bar.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
|
.file("baz/Cargo.toml", &basic_lib_manifest("baz"))
|
||||||
.file(
|
.file("baz/src/baz.rs", "pub fn baz() {}")
|
||||||
"baz/src/baz.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
@ -667,15 +623,9 @@ fn override_self() {
|
||||||
|
|
||||||
let p = project();
|
let p = project();
|
||||||
let root = p.root().clone();
|
let root = p.root().clone();
|
||||||
let p = p.file(
|
let p = p
|
||||||
".cargo/config",
|
.file(".cargo/config", &format!("paths = ['{}']", root.display()))
|
||||||
&format!(
|
.file(
|
||||||
r#"
|
|
||||||
paths = ['{}']
|
|
||||||
"#,
|
|
||||||
root.display()
|
|
||||||
),
|
|
||||||
).file(
|
|
||||||
"Cargo.toml",
|
"Cargo.toml",
|
||||||
&format!(
|
&format!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -723,9 +673,7 @@ fn override_path_dep() {
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
&format!(
|
&format!(
|
||||||
r#"
|
"paths = ['{}', '{}']",
|
||||||
paths = ['{}', '{}']
|
|
||||||
"#,
|
|
||||||
bar.root().join("p1").display(),
|
bar.root().join("p1").display(),
|
||||||
bar.root().join("p2").display()
|
bar.root().join("p2").display()
|
||||||
),
|
),
|
||||||
|
@ -796,12 +744,7 @@ fn path_dep_build_cmd() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/bar.rs.in", "pub fn gimme() -> i32 { 0 }")
|
||||||
"bar/src/bar.rs.in",
|
|
||||||
r#"
|
|
||||||
pub fn gimme() -> i32 { 0 }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
p.root().join("bar").move_into_the_past();
|
p.root().join("bar").move_into_the_past();
|
||||||
|
|
||||||
|
@ -990,12 +933,7 @@ fn override_and_depend() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("b/src/lib.rs", "")
|
.file("b/src/lib.rs", "")
|
||||||
.file(
|
.file("b/.cargo/config", r#"paths = ["../a"]"#)
|
||||||
"b/.cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["../a"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build").cwd(p.root().join("b")),
|
p.cargo("build").cwd(p.root().join("b")),
|
||||||
|
@ -1015,12 +953,7 @@ fn missing_path_dependency() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_manifest("a", "0.5.0"))
|
.file("Cargo.toml", &basic_manifest("a", "0.5.0"))
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file(".cargo/config", r#"paths = ["../whoa-this-does-not-exist"]"#)
|
||||||
".cargo/config",
|
|
||||||
r#"
|
|
||||||
paths = ["../whoa-this-does-not-exist"]
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("build"),
|
p.cargo("build"),
|
||||||
|
|
|
@ -132,13 +132,7 @@ fn plugin_with_dynamic_native_dependency() {
|
||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[no_mangle] pub extern fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let foo = project().at("ws/foo")
|
let foo = project().at("ws/foo")
|
||||||
|
@ -268,13 +262,7 @@ fn doctest_a_plugin() {
|
||||||
bar = { path = "bar" }
|
bar = { path = "bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[macro_use] extern crate bar;")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[macro_use]
|
|
||||||
extern crate bar;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -288,12 +276,7 @@ fn doctest_a_plugin() {
|
||||||
plugin = true
|
plugin = true
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("test").arg("-v"), execs().with_status(0));
|
assert_that(p.cargo("test").arg("-v"), execs().with_status(0));
|
||||||
|
@ -429,12 +412,7 @@ fn shared_panic_abort_plugins() {
|
||||||
baz = { path = "baz" }
|
baz = { path = "baz" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate baz;")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate baz;
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -273,13 +273,8 @@ fn profile_override_hierarchy() {
|
||||||
m2 = { path = "../m2" }
|
m2 = { path = "../m2" }
|
||||||
dep = { path = "../../dep" }
|
dep = { path = "../../dep" }
|
||||||
"#)
|
"#)
|
||||||
.file("m1/src/lib.rs",
|
.file("m1/src/lib.rs", "extern crate m2; extern crate dep;")
|
||||||
r#"
|
.file("m1/build.rs", "fn main() {}")
|
||||||
extern crate m2;
|
|
||||||
extern crate dep;
|
|
||||||
"#)
|
|
||||||
.file("m1/build.rs",
|
|
||||||
r#"fn main() {}"#)
|
|
||||||
|
|
||||||
// m2
|
// m2
|
||||||
.file("m2/Cargo.toml",
|
.file("m2/Cargo.toml",
|
||||||
|
@ -295,16 +290,8 @@ fn profile_override_hierarchy() {
|
||||||
m3 = { path = "../m3" }
|
m3 = { path = "../m3" }
|
||||||
dep = { path = "../../dep" }
|
dep = { path = "../../dep" }
|
||||||
"#)
|
"#)
|
||||||
.file("m2/src/lib.rs",
|
.file("m2/src/lib.rs", "extern crate m3;")
|
||||||
r#"
|
.file("m2/build.rs", "extern crate m3; extern crate dep; fn main() {}")
|
||||||
extern crate m3;
|
|
||||||
"#)
|
|
||||||
.file("m2/build.rs",
|
|
||||||
r#"
|
|
||||||
extern crate m3;
|
|
||||||
extern crate dep;
|
|
||||||
fn main() {}
|
|
||||||
"#)
|
|
||||||
|
|
||||||
// m3
|
// m3
|
||||||
.file("m3/Cargo.toml", &basic_lib_manifest("m3"))
|
.file("m3/Cargo.toml", &basic_lib_manifest("m3"))
|
||||||
|
@ -413,10 +400,7 @@ fn profile_override_spec() {
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dep = { path = "../../dep1" }
|
dep = { path = "../../dep1" }
|
||||||
"#)
|
"#)
|
||||||
.file("m1/src/lib.rs",
|
.file("m1/src/lib.rs", "extern crate dep;")
|
||||||
r#"
|
|
||||||
extern crate dep;
|
|
||||||
"#)
|
|
||||||
|
|
||||||
// m2
|
// m2
|
||||||
.file("m2/Cargo.toml",
|
.file("m2/Cargo.toml",
|
||||||
|
@ -428,10 +412,7 @@ fn profile_override_spec() {
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dep = {path = "../../dep2" }
|
dep = {path = "../../dep2" }
|
||||||
"#)
|
"#)
|
||||||
.file("m2/src/lib.rs",
|
.file("m2/src/lib.rs", "extern crate dep;")
|
||||||
r#"
|
|
||||||
extern crate dep;
|
|
||||||
"#)
|
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,8 @@ fn all_target_project() -> Project {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "extern crate bar;")
|
.file("src/lib.rs", "extern crate bar;")
|
||||||
.file("src/main.rs", r#"
|
.file("src/main.rs", "extern crate foo; fn main() {}")
|
||||||
extern crate foo;
|
.file("examples/ex1.rs", "extern crate foo; fn main() {}")
|
||||||
fn main() {}
|
|
||||||
"#)
|
|
||||||
.file("examples/ex1.rs", r#"
|
|
||||||
extern crate foo;
|
|
||||||
fn main() {}
|
|
||||||
"#)
|
|
||||||
.file("tests/test1.rs", "extern crate foo;")
|
.file("tests/test1.rs", "extern crate foo;")
|
||||||
.file("benches/bench1.rs", "extern crate foo;")
|
.file("benches/bench1.rs", "extern crate foo;")
|
||||||
.file("build.rs", r#"
|
.file("build.rs", r#"
|
||||||
|
|
|
@ -861,12 +861,7 @@ fn bad_license_file() {
|
||||||
repository = "baz"
|
repository = "baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("publish")
|
p.cargo("publish")
|
||||||
|
@ -1784,14 +1779,7 @@ fn toml_lies_but_index_is_truth() {
|
||||||
#[test]
|
#[test]
|
||||||
fn vv_prints_warnings() {
|
fn vv_prints_warnings() {
|
||||||
Package::new("foo", "0.2.0")
|
Package::new("foo", "0.2.0")
|
||||||
.file(
|
.file("src/lib.rs", "#![deny(warnings)] fn foo() {} // unused function")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#![deny(warnings)]
|
|
||||||
|
|
||||||
fn foo() {} // unused function
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.publish();
|
.publish();
|
||||||
|
|
||||||
let p = project()
|
let p = project()
|
||||||
|
|
|
@ -89,13 +89,7 @@ fn rename_dependency() {
|
||||||
baz = { version = "0.2.0", package = "bar" }
|
baz = { version = "0.2.0", package = "bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; extern crate baz;")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
extern crate baz;
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -121,12 +115,7 @@ fn rename_with_different_names() {
|
||||||
baz = { path = "bar", package = "bar" }
|
baz = { path = "bar", package = "bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate baz;")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate baz;
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -236,16 +225,7 @@ fn rename_and_patch() {
|
||||||
foo = { path = "foo" }
|
foo = { path = "foo" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() { bar::foo(); }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
extern crate bar;
|
|
||||||
|
|
||||||
pub fn foo() {
|
|
||||||
bar::foo();
|
|
||||||
}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file("foo/Cargo.toml", &basic_manifest("foo", "0.1.0"))
|
.file("foo/Cargo.toml", &basic_manifest("foo", "0.1.0"))
|
||||||
.file("foo/src/lib.rs", "pub fn foo() {}")
|
.file("foo/src/lib.rs", "pub fn foo() {}")
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -36,13 +36,7 @@ fn build_bin_default_features() {
|
||||||
fn main() {}
|
fn main() {}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", r#"#[cfg(feature = "a")] pub fn foo() {}"#)
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(feature = "a")]
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
|
|
@ -6,12 +6,7 @@ use support::hamcrest::{assert_that, existing_file};
|
||||||
#[test]
|
#[test]
|
||||||
fn simple() {
|
fn simple() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -33,12 +28,7 @@ fn simple() {
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_quiet() {
|
fn simple_quiet() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -55,12 +45,7 @@ fn simple_quiet() {
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_quiet_and_verbose() {
|
fn simple_quiet_and_verbose() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -81,12 +66,7 @@ fn quiet_and_verbose_config() {
|
||||||
verbose = true
|
verbose = true
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("run").arg("-q"), execs().with_status(0));
|
assert_that(p.cargo("run").arg("-q"), execs().with_status(0));
|
||||||
|
@ -115,12 +95,7 @@ fn simple_with_args() {
|
||||||
#[test]
|
#[test]
|
||||||
fn exit_code() {
|
fn exit_code() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() { std::process::exit(2); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { std::process::exit(2); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut output = String::from(
|
let mut output = String::from(
|
||||||
|
@ -141,12 +116,7 @@ fn exit_code() {
|
||||||
#[test]
|
#[test]
|
||||||
fn exit_code_verbose() {
|
fn exit_code_verbose() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() { std::process::exit(2); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { std::process::exit(2); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let mut output = String::from(
|
let mut output = String::from(
|
||||||
|
@ -389,18 +359,8 @@ consider adding `cargo-features = ["default-run"]` to the manifest
|
||||||
fn run_example() {
|
fn run_example() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("examples/a.rs", r#"fn main() { println!("example"); }"#)
|
||||||
"examples/a.rs",
|
.file("src/bin/a.rs", r#"fn main() { println!("bin"); }"#)
|
||||||
r#"
|
|
||||||
fn main() { println!("example"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("bin"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -434,12 +394,7 @@ fn run_library_example() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("examples/bar.rs", "fn foo() {}")
|
||||||
"examples/bar.rs",
|
|
||||||
r#"
|
|
||||||
fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -480,12 +435,7 @@ fn autodiscover_examples_project(rust_edition: &str, autoexamples: Option<bool>)
|
||||||
autoexamples = autoexamples
|
autoexamples = autoexamples
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.file(
|
.file("examples/a.rs", r#"fn main() { println!("example"); }"#)
|
||||||
"examples/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("example"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"examples/do_magic.rs",
|
"examples/do_magic.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -602,18 +552,8 @@ fn run_example_autodiscover_2018() {
|
||||||
fn run_bins() {
|
fn run_bins() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("examples/a.rs", r#"fn main() { println!("example"); }"#)
|
||||||
"examples/a.rs",
|
.file("src/bin/a.rs", r#"fn main() { println!("bin"); }"#)
|
||||||
r#"
|
|
||||||
fn main() { println!("example"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("bin"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -635,12 +575,7 @@ fn run_with_filename() {
|
||||||
fn main() { println!("hello a.rs"); }
|
fn main() { println!("hello a.rs"); }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("examples/a.rs", r#"fn main() { println!("example"); }"#)
|
||||||
"examples/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("example"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -681,18 +616,8 @@ Did you mean `a`?",
|
||||||
#[test]
|
#[test]
|
||||||
fn either_name_or_example() {
|
fn either_name_or_example() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/bin/a.rs", r#"fn main() { println!("hello a.rs"); }"#)
|
||||||
"src/bin/a.rs",
|
.file("examples/b.rs", r#"fn main() { println!("hello b.rs"); }"#)
|
||||||
r#"
|
|
||||||
fn main() { println!("hello a.rs"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"examples/b.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello b.rs"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -713,24 +638,9 @@ fn either_name_or_example() {
|
||||||
fn one_bin_multiple_examples() {
|
fn one_bin_multiple_examples() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("src/bin/main.rs", r#"fn main() { println!("hello main.rs"); }"#)
|
||||||
"src/bin/main.rs",
|
.file("examples/a.rs", r#"fn main() { println!("hello a.rs"); }"#)
|
||||||
r#"
|
.file("examples/b.rs", r#"fn main() { println!("hello b.rs"); }"#)
|
||||||
fn main() { println!("hello main.rs"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"examples/a.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello a.rs"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"examples/b.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello b.rs"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -882,13 +792,7 @@ fn run_dylib_dep() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", r#"extern crate bar; fn main() { bar::bar(); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { bar::bar(); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -951,12 +855,7 @@ fn run_bin_different_name() {
|
||||||
name = "bar"
|
name = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/bar.rs", "fn main() {}")
|
||||||
"src/bar.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("run"), execs().with_status(0));
|
assert_that(p.cargo("run"), execs().with_status(0));
|
||||||
|
@ -988,12 +887,7 @@ fn dashes_are_forwarded() {
|
||||||
#[test]
|
#[test]
|
||||||
fn run_from_executable_folder() {
|
fn run_from_executable_folder() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", r#"fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { println!("hello"); }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let cwd = p.root().join("target").join("debug");
|
let cwd = p.root().join("target").join("debug");
|
||||||
|
@ -1128,14 +1022,7 @@ fn library_paths_sorted_alphabetically() {
|
||||||
#[test]
|
#[test]
|
||||||
fn fail_no_extra_verbose() {
|
fn fail_no_extra_verbose() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() { std::process::exit(1); }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -8,12 +8,7 @@ the package by passing e.g. `--lib` or `--bin NAME` to specify a single target";
|
||||||
#[test]
|
#[test]
|
||||||
fn build_lib_for_foo() {
|
fn build_lib_for_foo() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -38,12 +33,7 @@ fn build_lib_for_foo() {
|
||||||
#[test]
|
#[test]
|
||||||
fn lib() {
|
fn lib() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -74,12 +64,7 @@ fn lib() {
|
||||||
#[test]
|
#[test]
|
||||||
fn build_main_and_allow_unstable_options() {
|
fn build_main_and_allow_unstable_options() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -113,12 +98,7 @@ fn build_main_and_allow_unstable_options() {
|
||||||
#[test]
|
#[test]
|
||||||
fn fails_when_trying_to_build_main_and_lib_with_args() {
|
fn fails_when_trying_to_build_main_and_lib_with_args() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -135,24 +115,9 @@ fn fails_when_trying_to_build_main_and_lib_with_args() {
|
||||||
#[test]
|
#[test]
|
||||||
fn build_with_args_to_one_of_multiple_binaries() {
|
fn build_with_args_to_one_of_multiple_binaries() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/bin/foo.rs", "fn main() {}")
|
||||||
"src/bin/foo.rs",
|
.file("src/bin/bar.rs", "fn main() {}")
|
||||||
r#"
|
.file("src/bin/baz.rs", "fn main() {}")
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/bar.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/baz.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -176,24 +141,9 @@ fn build_with_args_to_one_of_multiple_binaries() {
|
||||||
#[test]
|
#[test]
|
||||||
fn fails_with_args_to_all_binaries() {
|
fn fails_with_args_to_all_binaries() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/bin/foo.rs", "fn main() {}")
|
||||||
"src/bin/foo.rs",
|
.file("src/bin/bar.rs", "fn main() {}")
|
||||||
r#"
|
.file("src/bin/baz.rs", "fn main() {}")
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/bar.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"src/bin/baz.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -248,24 +198,11 @@ fn build_foo_with_bar_dependency() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::baz() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
bar::baz()
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -302,24 +239,11 @@ fn build_only_bar_dependency() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::baz() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
bar::baz()
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -398,12 +322,7 @@ fn fail_with_multiple_packages() {
|
||||||
path = "../baz"
|
path = "../baz"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
|
|
|
@ -4,7 +4,7 @@ use support::hamcrest::assert_that;
|
||||||
#[test]
|
#[test]
|
||||||
fn rustdoc_simple() {
|
fn rustdoc_simple() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -26,7 +26,7 @@ fn rustdoc_simple() {
|
||||||
#[test]
|
#[test]
|
||||||
fn rustdoc_args() {
|
fn rustdoc_args() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -61,22 +61,11 @@ fn rustdoc_foo_with_bar_dependency() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "extern crate bar; pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
pub fn foo() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -114,24 +103,11 @@ fn rustdoc_only_bar_dependency() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "extern crate bar; fn main() { bar::baz() }")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() {
|
|
||||||
bar::baz()
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn baz() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn baz() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -158,12 +134,7 @@ fn rustdoc_only_bar_dependency() {
|
||||||
#[test]
|
#[test]
|
||||||
fn rustdoc_same_name_documents_lib() {
|
fn rustdoc_same_name_documents_lib() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("src/lib.rs", r#" "#)
|
.file("src/lib.rs", r#" "#)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,7 @@ fn env_rustflags_build_script_dep() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
|
@ -177,12 +172,7 @@ fn env_rustflags_plugin_dep() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn foo() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
||||||
|
@ -316,12 +306,7 @@ fn env_rustflags_build_script_dep_with_target() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
|
@ -404,12 +389,7 @@ fn env_rustflags_plugin_dep_with_target() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn foo() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
let _bar = project().at("bar")
|
let _bar = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
.file("Cargo.toml", &basic_lib_manifest("bar"))
|
||||||
|
@ -568,12 +548,7 @@ fn build_rustflags_build_script_dep() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -656,12 +631,7 @@ fn build_rustflags_plugin_dep() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn foo() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -795,12 +765,7 @@ fn build_rustflags_build_script_dep_with_target() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("build.rs", "fn main() {}")
|
||||||
"build.rs",
|
|
||||||
r#"
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
@ -891,12 +856,7 @@ fn build_rustflags_plugin_dep_with_target() {
|
||||||
path = "../bar"
|
path = "../bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
fn foo() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
".cargo/config",
|
".cargo/config",
|
||||||
r#"
|
r#"
|
||||||
|
|
|
@ -67,16 +67,7 @@ fn setup() {
|
||||||
|
|
||||||
// Init a new registry
|
// Init a new registry
|
||||||
let _ = repo(®istry_path())
|
let _ = repo(®istry_path())
|
||||||
.file(
|
.file("config.json", &format!(r#"{{"dl":"{0}","api":"{0}"}}"#, api()))
|
||||||
"config.json",
|
|
||||||
&format!(
|
|
||||||
r#"{{
|
|
||||||
"dl": "{0}",
|
|
||||||
"api": "{0}"
|
|
||||||
}}"#,
|
|
||||||
api()
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let base = api_path().join("api/v1/crates");
|
let base = api_path().join("api/v1/crates");
|
||||||
|
|
|
@ -304,21 +304,8 @@ failures:
|
||||||
fn cargo_test_failing_test_in_test() {
|
fn cargo_test_failing_test_in_test() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
.file("Cargo.toml", &basic_bin_manifest("foo"))
|
||||||
.file(
|
.file("src/main.rs", r#"pub fn main() { println!("hello"); }"#)
|
||||||
"src/main.rs",
|
.file("tests/footest.rs", "#[test] fn test_hello() { assert!(false) }")
|
||||||
r#"
|
|
||||||
pub fn main() {
|
|
||||||
println!("hello");
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/footest.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn test_hello() {
|
|
||||||
assert!(false)
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("build"), execs().with_status(0));
|
assert_that(p.cargo("build"), execs().with_status(0));
|
||||||
|
@ -351,7 +338,7 @@ failures:
|
||||||
|
|
||||||
---- test_hello stdout ----
|
---- test_hello stdout ----
|
||||||
[..]thread 'test_hello' panicked at 'assertion failed: false', \
|
[..]thread 'test_hello' panicked at 'assertion failed: false', \
|
||||||
tests[/]footest.rs:4[..]
|
tests[/]footest.rs:1[..]
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.with_stdout_contains(
|
.with_stdout_contains(
|
||||||
|
@ -368,14 +355,7 @@ failures:
|
||||||
fn cargo_test_failing_test_in_lib() {
|
fn cargo_test_failing_test_in_lib() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file("Cargo.toml", &basic_lib_manifest("foo"))
|
.file("Cargo.toml", &basic_lib_manifest("foo"))
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn test_hello() { assert!(false) }")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn test_hello() {
|
|
||||||
assert!(false)
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -397,7 +377,7 @@ failures:
|
||||||
|
|
||||||
---- test_hello stdout ----
|
---- test_hello stdout ----
|
||||||
[..]thread 'test_hello' panicked at 'assertion failed: false', \
|
[..]thread 'test_hello' panicked at 'assertion failed: false', \
|
||||||
src[/]lib.rs:4[..]
|
src[/]lib.rs:1[..]
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.with_stdout_contains(
|
.with_stdout_contains(
|
||||||
|
@ -508,15 +488,7 @@ fn test_with_deep_lib_dep() {
|
||||||
.build();
|
.build();
|
||||||
let _p2 = project().at("bar")
|
let _p2 = project().at("bar")
|
||||||
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file("src/lib.rs", "pub fn bar() {} #[test] fn foo_test() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn bar() {}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn foo_test() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -608,13 +580,7 @@ fn external_test_named_test() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("src/lib.rs", "")
|
.file("src/lib.rs", "")
|
||||||
.file(
|
.file("tests/test.rs", "#[test] fn foo() {}")
|
||||||
"tests/test.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn foo() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("test"), execs().with_status(0))
|
assert_that(p.cargo("test"), execs().with_status(0))
|
||||||
|
@ -665,11 +631,7 @@ fn external_test_implicit() {
|
||||||
#[test]
|
#[test]
|
||||||
fn dont_run_examples() {
|
fn dont_run_examples() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "")
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"examples/dont-run-me-i-will-fail.rs",
|
"examples/dont-run-me-i-will-fail.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -764,12 +726,7 @@ fn lib_bin_same_name() {
|
||||||
name = "foo"
|
name = "foo"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn lib_test() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
#[test] fn lib_test() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -863,12 +820,7 @@ fn lib_with_standard_name2() {
|
||||||
doctest = false
|
doctest = false
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -913,12 +865,7 @@ fn lib_without_name() {
|
||||||
doctest = false
|
doctest = false
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -966,12 +913,7 @@ fn bin_without_name() {
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -1016,12 +958,7 @@ fn bench_without_name() {
|
||||||
path = "src/bench.rs"
|
path = "src/bench.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -1137,12 +1074,7 @@ fn example_without_name() {
|
||||||
path = "examples/example.rs"
|
path = "examples/example.rs"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "pub fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
"
|
"
|
||||||
|
@ -1267,12 +1199,7 @@ fn test_dylib() {
|
||||||
crate_type = ["dylib"]
|
crate_type = ["dylib"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("bar/src/lib.rs", "pub fn baz() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
"
|
|
||||||
pub fn baz() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1320,13 +1247,7 @@ fn test_twice_with_build_cmd() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("build.rs", "fn main() {}")
|
.file("build.rs", "fn main() {}")
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
#[test]
|
|
||||||
fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1363,13 +1284,7 @@ fn test_twice_with_build_cmd() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_then_build() {
|
fn test_then_build() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn foo() {}")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
#[test]
|
|
||||||
fn foo() {}
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1394,13 +1309,7 @@ fn test_then_build() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_no_run() {
|
fn test_no_run() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn foo() { panic!() }")
|
||||||
"src/lib.rs",
|
|
||||||
"
|
|
||||||
#[test]
|
|
||||||
fn foo() { panic!() }
|
|
||||||
",
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -1914,10 +1823,7 @@ fn build_then_selective_test() {
|
||||||
path = "b"
|
path = "b"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[allow(unused_extern_crates)] extern crate b;")
|
||||||
"src/lib.rs",
|
|
||||||
"#[allow(unused_extern_crates)] extern crate b;",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"src/main.rs",
|
"src/main.rs",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1952,18 +1858,8 @@ fn example_dev_dep() {
|
||||||
path = "bar"
|
path = "bar"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "")
|
||||||
"src/lib.rs",
|
.file("examples/e1.rs", "extern crate bar; fn main() {}")
|
||||||
r#"
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"examples/e1.rs",
|
|
||||||
r#"
|
|
||||||
extern crate bar;
|
|
||||||
fn main() { }
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
|
||||||
.file(
|
.file(
|
||||||
"bar/src/lib.rs",
|
"bar/src/lib.rs",
|
||||||
|
@ -2791,15 +2687,7 @@ fn cfg_test_even_with_no_harness() {
|
||||||
doctest = false
|
doctest = false
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", r#"#[cfg(test)] fn main() { println!("hello!"); }"#)
|
||||||
"src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[cfg(test)]
|
|
||||||
fn main() {
|
|
||||||
println!("hello!");
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
assert_that(
|
assert_that(
|
||||||
p.cargo("test").arg("-v"),
|
p.cargo("test").arg("-v"),
|
||||||
|
@ -3018,21 +2906,9 @@ fn test_all_workspace() {
|
||||||
[workspace]
|
[workspace]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "#[test] fn foo_test() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn foo_test() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "#[test] fn bar_test() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn bar_test() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3058,30 +2934,11 @@ fn test_all_exclude() {
|
||||||
members = ["bar", "baz"]
|
members = ["bar", "baz"]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/main.rs", "fn main() {}")
|
||||||
"src/main.rs",
|
|
||||||
r#"
|
|
||||||
fn main() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file(
|
.file("bar/src/lib.rs", "#[test] pub fn bar() {}")
|
||||||
"bar/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
pub fn bar() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
.file("baz/Cargo.toml", &basic_manifest("baz", "0.1.0"))
|
||||||
.file(
|
.file("baz/src/lib.rs", "#[test] pub fn baz() { assert!(false); }")
|
||||||
"baz/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
pub fn baz() {
|
|
||||||
assert!(false);
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3104,21 +2961,9 @@ fn test_all_virtual_manifest() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
||||||
.file(
|
.file("a/src/lib.rs", "#[test] fn a() {}")
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
||||||
.file(
|
.file("b/src/lib.rs", "#[test] fn b() {}")
|
||||||
"b/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn b() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3141,21 +2986,9 @@ fn test_virtual_manifest_all_implied() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
||||||
.file(
|
.file("a/src/lib.rs", "#[test] fn a() {}")
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
||||||
.file(
|
.file("b/src/lib.rs", "#[test] fn b() {}")
|
||||||
"b/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn b() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3188,13 +3021,7 @@ fn test_all_member_dependency_same_name() {
|
||||||
a = "0.1.0"
|
a = "0.1.0"
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("a/src/lib.rs", "#[test] fn a() {}")
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Package::new("a", "0.1.0").publish();
|
Package::new("a", "0.1.0").publish();
|
||||||
|
@ -3231,12 +3058,7 @@ fn doctest_only_with_dev_dep() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
||||||
.file(
|
.file("b/src/lib.rs", "pub fn b() {}")
|
||||||
"b/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
pub fn b() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3283,30 +3105,10 @@ fn test_many_targets() {
|
||||||
#[test] fn example_b() {}
|
#[test] fn example_b() {}
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("examples/c.rs", "#[test] fn example_c() { panic!(); }")
|
||||||
"examples/c.rs",
|
.file("tests/a.rs", "#[test] fn test_a() {}")
|
||||||
r#"
|
.file("tests/b.rs", "#[test] fn test_b() {}")
|
||||||
#[test] fn example_c() { panic!(); }
|
.file("tests/c.rs", "does not compile")
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/a.rs",
|
|
||||||
r#"
|
|
||||||
#[test] fn test_a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/b.rs",
|
|
||||||
r#"
|
|
||||||
#[test] fn test_b() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/c.rs",
|
|
||||||
r#"
|
|
||||||
does not compile
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3422,24 +3224,9 @@ test env_test ... ok
|
||||||
#[test]
|
#[test]
|
||||||
fn test_order() {
|
fn test_order() {
|
||||||
let p = project()
|
let p = project()
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn test_lib() {}")
|
||||||
"src/lib.rs",
|
.file("tests/a.rs", "#[test] fn test_a() {}")
|
||||||
r#"
|
.file("tests/z.rs", "#[test] fn test_z() {}")
|
||||||
#[test] fn test_lib() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/a.rs",
|
|
||||||
r#"
|
|
||||||
#[test] fn test_a() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/z.rs",
|
|
||||||
r#"
|
|
||||||
#[test] fn test_z() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
@ -3481,18 +3268,8 @@ fn cyclic_dev() {
|
||||||
foo = { path = "." }
|
foo = { path = "." }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("src/lib.rs", "#[test] fn test_lib() {}")
|
||||||
"src/lib.rs",
|
.file("tests/foo.rs", "extern crate foo;")
|
||||||
r#"
|
|
||||||
#[test] fn test_lib() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file(
|
|
||||||
"tests/foo.rs",
|
|
||||||
r#"
|
|
||||||
extern crate foo;
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(p.cargo("test").arg("--all"), execs().with_status(0));
|
assert_that(p.cargo("test").arg("--all"), execs().with_status(0));
|
||||||
|
@ -3664,21 +3441,9 @@ fn test_hint_workspace() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
.file("a/Cargo.toml", &basic_manifest("a", "0.1.0"))
|
||||||
.file(
|
.file("a/src/lib.rs", "#[test] fn t1() {}")
|
||||||
"a/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn t1() {}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
.file("b/Cargo.toml", &basic_manifest("b", "0.1.0"))
|
||||||
.file(
|
.file("b/src/lib.rs", "#[test] fn t1() {assert!(false)}")
|
||||||
"b/src/lib.rs",
|
|
||||||
r#"
|
|
||||||
#[test]
|
|
||||||
fn t1() {assert!(false)}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_that(
|
assert_that(
|
||||||
|
|
|
@ -1423,10 +1423,7 @@ fn test_in_and_out_of_workspace() {
|
||||||
members = [ "../bar" ]
|
members = [ "../bar" ]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("ws/src/lib.rs", r"extern crate foo; pub fn f() { foo::f() }")
|
||||||
"ws/src/lib.rs",
|
|
||||||
r"extern crate foo; pub fn f() { foo::f() }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"foo/Cargo.toml",
|
"foo/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1439,10 +1436,7 @@ fn test_in_and_out_of_workspace() {
|
||||||
bar = { path = "../bar" }
|
bar = { path = "../bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("foo/src/lib.rs", "extern crate bar; pub fn f() { bar::f() }")
|
||||||
"foo/src/lib.rs",
|
|
||||||
"extern crate bar; pub fn f() { bar::f() }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"bar/Cargo.toml",
|
"bar/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1495,10 +1489,7 @@ fn test_path_dependency_under_member() {
|
||||||
[workspace]
|
[workspace]
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("ws/src/lib.rs", r"extern crate foo; pub fn f() { foo::f() }")
|
||||||
"ws/src/lib.rs",
|
|
||||||
r"extern crate foo; pub fn f() { foo::f() }",
|
|
||||||
)
|
|
||||||
.file(
|
.file(
|
||||||
"foo/Cargo.toml",
|
"foo/Cargo.toml",
|
||||||
r#"
|
r#"
|
||||||
|
@ -1512,10 +1503,7 @@ fn test_path_dependency_under_member() {
|
||||||
bar = { path = "./bar" }
|
bar = { path = "./bar" }
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.file(
|
.file("foo/src/lib.rs", "extern crate bar; pub fn f() { bar::f() }")
|
||||||
"foo/src/lib.rs",
|
|
||||||
"extern crate bar; pub fn f() { bar::f() }",
|
|
||||||
)
|
|
||||||
.file("foo/bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
.file("foo/bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
|
||||||
.file("foo/bar/src/lib.rs", "pub fn f() { }");
|
.file("foo/bar/src/lib.rs", "pub fn f() { }");
|
||||||
let p = p.build();
|
let p = p.build();
|
||||||
|
|
Loading…
Reference in a new issue