diff --git a/tests/build-lib.rs b/tests/build-lib.rs index f0390194b..44c41b8f3 100644 --- a/tests/build-lib.rs +++ b/tests/build-lib.rs @@ -1,21 +1,19 @@ extern crate cargotest; extern crate hamcrest; -use std::path::MAIN_SEPARATOR as SEP; - use cargotest::support::{basic_bin_manifest, execs, project, ProjectBuilder}; use hamcrest::{assert_that}; fn verbose_output_for_lib(p: &ProjectBuilder) -> String { format!("\ [COMPILING] {name} v{version} ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name {name} --crate-type lib -g \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, +", dir = p.root().display(), url = p.url(), name = "foo", version = "0.0.1") } diff --git a/tests/profiles.rs b/tests/profiles.rs index ab060bba2..6135acc54 100644 --- a/tests/profiles.rs +++ b/tests/profiles.rs @@ -2,7 +2,6 @@ extern crate cargotest; extern crate hamcrest; use std::env; -use std::path::MAIN_SEPARATOR as SEP; use cargotest::is_nightly; use cargotest::support::{project, execs}; @@ -28,16 +27,16 @@ fn profile_overrides() { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr(&format!("\ [COMPILING] test v0.0.0 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \ +[RUNNING] `rustc src[/]lib.rs --crate-name test --crate-type lib \ -C opt-level=1 \ -C debug-assertions=on \ -C metadata=[..] \ -C rpath \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [optimized] target(s) in [..] -", sep = SEP, +", dir = p.root().display(), url = p.url(), ))); @@ -61,14 +60,14 @@ fn opt_level_override_0() { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr(&format!("\ [COMPILING] test v0.0.0 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \ +[RUNNING] `rustc src[/]lib.rs --crate-name test --crate-type lib \ -g \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] [..] target(s) in [..] -", sep = SEP, +", dir = p.root().display(), url = p.url() ))); @@ -91,16 +90,16 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) { assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr(&format!("\ [COMPILING] test v0.0.0 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \ +[RUNNING] `rustc src[/]lib.rs --crate-name test --crate-type lib \ -C opt-level={level} \ -g \ -C debug-assertions=on \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] [..] target(s) in [..] -", sep = SEP, +", dir = p.root().display(), url = p.url(), level = rustc_level @@ -160,30 +159,29 @@ fn top_level_overrides_deps() { assert_that(p.cargo_process("build").arg("-v").arg("--release"), execs().with_status(0).with_stderr(&format!("\ [COMPILING] foo v0.0.0 ({url}/foo) -[RUNNING] `rustc foo{sep}src{sep}lib.rs --crate-name foo \ +[RUNNING] `rustc foo[/]src[/]lib.rs --crate-name foo \ --crate-type dylib --crate-type rlib -C prefer-dynamic \ -C opt-level=1 \ -g \ -C metadata=[..] \ - --out-dir {dir}{sep}target{sep}release{sep}deps \ + --out-dir {dir}[/]target[/]release[/]deps \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}release{sep}deps` + -L dependency={dir}[/]target[/]release[/]deps` [COMPILING] test v0.0.0 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name test --crate-type lib \ +[RUNNING] `rustc src[/]lib.rs --crate-name test --crate-type lib \ -C opt-level=1 \ -g \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}release{sep}deps \ - --extern foo={dir}{sep}target{sep}release{sep}deps{sep}\ + -L dependency={dir}[/]target[/]release[/]deps \ + --extern foo={dir}[/]target[/]release[/]deps[/]\ {prefix}foo[..]{suffix} \ - --extern foo={dir}{sep}target{sep}release{sep}deps{sep}libfoo.rlib` + --extern foo={dir}[/]target[/]release[/]deps[/]libfoo.rlib` [FINISHED] release [optimized + debuginfo] target(s) in [..] ", dir = p.root().display(), url = p.url(), - sep = SEP, prefix = env::consts::DLL_PREFIX, suffix = env::consts::DLL_SUFFIX))); } diff --git a/tests/run.rs b/tests/run.rs index 13a8472ce..146076138 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -2,8 +2,6 @@ extern crate cargo; extern crate cargotest; extern crate hamcrest; -use std::path::MAIN_SEPARATOR as SEP; - use cargo::util::paths::dylib_path_envvar; use cargotest::support::{project, execs, path2url}; use hamcrest::{assert_that, existing_file}; @@ -26,7 +24,7 @@ fn simple() { .with_stderr(&format!("\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}foo[EXE]`", dir = path2url(p.root()), sep = SEP)) +[RUNNING] `target[/]debug[/]foo[EXE]`", dir = path2url(p.root()))) .with_stdout("\ hello ")); @@ -232,18 +230,18 @@ fn specify_name() { [RUNNING] `rustc src[/]lib.rs [..]` [RUNNING] `rustc src[/]bin[/]a.rs [..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}a[EXE]`", dir = path2url(p.root()), sep = SEP)) +[RUNNING] `target[/]debug[/]a[EXE]`", dir = path2url(p.root()))) .with_stdout("\ hello a.rs ")); assert_that(p.cargo("run").arg("--bin").arg("b").arg("-v"), execs().with_status(0) - .with_stderr(&format!("\ + .with_stderr("\ [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc src[/]bin[/]b.rs [..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}b[EXE]`", sep = SEP)) +[RUNNING] `target[/]debug[/]b[EXE]`") .with_stdout("\ hello b.rs ")); @@ -271,7 +269,7 @@ fn run_example() { .with_stderr(&format!("\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}examples{sep}a[EXE]`", dir = path2url(p.root()), sep = SEP)) +[RUNNING] `target[/]debug[/]examples[/]a[EXE]`", dir = path2url(p.root()))) .with_stdout("\ example ")); @@ -364,7 +362,7 @@ fn one_bin_multiple_examples() { .with_stderr(&format!("\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}main[EXE]`", dir = path2url(p.root()), sep = SEP)) +[RUNNING] `target[/]debug[/]main[EXE]`", dir = path2url(p.root()))) .with_stdout("\ hello main.rs ")); @@ -418,26 +416,26 @@ fn example_with_release_flag() { execs().with_status(0) .with_stderr(&format!("\ [COMPILING] bar v0.0.1 ({url}/bar) -[RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \ +[RUNNING] `rustc bar[/]src[/]bar.rs --crate-name bar --crate-type lib \ -C opt-level=3 \ -C metadata=[..] \ - --out-dir {dir}{sep}target{sep}release{sep}deps \ + --out-dir {dir}[/]target[/]release[/]deps \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}release{sep}deps` + -L dependency={dir}[/]target[/]release[/]deps` [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc examples{sep}a.rs --crate-name a --crate-type bin \ +[RUNNING] `rustc examples[/]a.rs --crate-name a --crate-type bin \ -C opt-level=3 \ -C metadata=[..] \ - --out-dir {dir}{sep}target{sep}release{sep}examples \ + --out-dir {dir}[/]target[/]release[/]examples \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}release{sep}deps \ - --extern bar={dir}{sep}target{sep}release{sep}deps{sep}libbar.rlib` + -L dependency={dir}[/]target[/]release[/]deps \ + --extern bar={dir}[/]target[/]release[/]deps[/]libbar.rlib` [FINISHED] release [optimized] target(s) in [..] -[RUNNING] `target{sep}release{sep}examples{sep}a[EXE]` +[RUNNING] `target[/]release[/]examples[/]a[EXE]` ", dir = p.root().display(), url = path2url(p.root()), - sep = SEP)) + )) .with_stdout("\ fast1 fast2")); @@ -446,26 +444,26 @@ fast2")); execs().with_status(0) .with_stderr(&format!("\ [COMPILING] bar v0.0.1 ({url}/bar) -[RUNNING] `rustc bar{sep}src{sep}bar.rs --crate-name bar --crate-type lib \ +[RUNNING] `rustc bar[/]src[/]bar.rs --crate-name bar --crate-type lib \ -g \ -C metadata=[..] \ - --out-dir {dir}{sep}target{sep}debug{sep}deps \ + --out-dir {dir}[/]target[/]debug[/]deps \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc examples{sep}a.rs --crate-name a --crate-type bin \ +[RUNNING] `rustc examples[/]a.rs --crate-name a --crate-type bin \ -g \ -C metadata=[..] \ - --out-dir {dir}{sep}target{sep}debug{sep}examples \ + --out-dir {dir}[/]target[/]debug[/]examples \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps \ - --extern bar={dir}{sep}target{sep}debug{sep}deps{sep}libbar.rlib` + -L dependency={dir}[/]target[/]debug[/]deps \ + --extern bar={dir}[/]target[/]debug[/]deps[/]libbar.rlib` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -[RUNNING] `target{sep}debug{sep}examples{sep}a[EXE]` +[RUNNING] `target[/]debug[/]examples[/]a[EXE]` ", dir = p.root().display(), url = path2url(p.root()), - sep = SEP)) + )) .with_stdout("\ slow1 slow2")); @@ -520,10 +518,10 @@ fn release_works() { execs().with_status(0).with_stderr(&format!("\ [COMPILING] foo v0.0.1 ({dir}) [FINISHED] release [optimized] target(s) in [..] -[RUNNING] `target{sep}release{sep}foo[EXE]` +[RUNNING] `target[/]release[/]foo[EXE]` ", dir = path2url(p.root()), - sep = SEP))); + ))); assert_that(&p.release_bin("foo"), existing_file()); } @@ -589,9 +587,9 @@ fn run_from_executable_folder() { assert_that(p.cargo("run").cwd(cwd), execs().with_status(0) - .with_stderr(&format!("\ + .with_stderr("\ [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]\n\ -[RUNNING] `.{sep}foo[EXE]`", sep = SEP)) +[RUNNING] `.[/]foo[EXE]`") .with_stdout("\ hello ")); diff --git a/tests/rustc.rs b/tests/rustc.rs index 85684280c..5e54bae5a 100644 --- a/tests/rustc.rs +++ b/tests/rustc.rs @@ -1,8 +1,6 @@ extern crate cargotest; extern crate hamcrest; -use std::path::MAIN_SEPARATOR as SEP; - use cargotest::support::{execs, project}; use hamcrest::assert_that; @@ -29,14 +27,13 @@ fn build_lib_for_foo() { .with_status(0) .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name foo --crate-type lib -g \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = p.root().display(), url = p.url()))); +", dir = p.root().display(), url = p.url()))); } #[test] @@ -59,15 +56,14 @@ fn lib() { .with_status(0) .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name foo --crate-type lib -g \ -C debug-assertions=off \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = p.root().display(), url = p.url()))) +", dir = p.root().display(), url = p.url()))) } #[test] @@ -90,20 +86,20 @@ fn build_main_and_allow_unstable_options() { .with_status(0) .with_stderr(&format!("\ [COMPILING] {name} v{version} ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name {name} --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name {name} --crate-type lib -g \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` -[RUNNING] `rustc src{sep}main.rs --crate-name {name} --crate-type bin -g \ + -L dependency={dir}[/]target[/]debug[/]deps` +[RUNNING] `rustc src[/]main.rs --crate-name {name} --crate-type bin -g \ -C debug-assertions \ -C metadata=[..] \ --out-dir [..] \ --emit=dep-info,link \ - -L dependency={dir}{sep}target{sep}debug{sep}deps \ - --extern {name}={dir}{sep}target[/]debug[/]deps[/]lib{name}.rlib` + -L dependency={dir}[/]target[/]debug[/]deps \ + --extern {name}={dir}[/]target[/]debug[/]deps[/]lib{name}.rlib` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, +", dir = p.root().display(), url = p.url(), name = "foo", version = "0.0.1"))); } @@ -155,13 +151,13 @@ fn build_with_args_to_one_of_multiple_binaries() { .with_status(0) .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name foo --crate-type lib -g \ -C metadata=[..] \ --out-dir [..]` -[RUNNING] `rustc src{sep}bin{sep}bar.rs --crate-name bar --crate-type bin -g \ +[RUNNING] `rustc src[/]bin[/]bar.rs --crate-name bar --crate-type bin -g \ -C debug-assertions [..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, url = p.url()))); +", url = p.url()))); } #[test] @@ -211,13 +207,13 @@ fn build_with_args_to_one_of_multiple_tests() { .with_status(0) .with_stderr(format!("\ [COMPILING] foo v0.0.1 ({url}) -[RUNNING] `rustc src{sep}lib.rs --crate-name foo --crate-type lib -g \ +[RUNNING] `rustc src[/]lib.rs --crate-name foo --crate-type lib -g \ -C metadata=[..] \ --out-dir [..]` -[RUNNING] `rustc tests{sep}bar.rs --crate-name bar -g \ +[RUNNING] `rustc tests[/]bar.rs --crate-name bar -g \ -C debug-assertions [..]--test[..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, url = p.url()))); +", url = p.url()))); } #[test] @@ -259,8 +255,7 @@ fn build_foo_with_bar_dependency() { [COMPILING] foo v0.0.1 ({url}) [RUNNING] `[..] -g -C debug-assertions [..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", - url = foo.url()))); +", url = foo.url()))); } #[test] diff --git a/tests/rustdoc.rs b/tests/rustdoc.rs index da1336f05..71f7fc507 100644 --- a/tests/rustdoc.rs +++ b/tests/rustdoc.rs @@ -1,8 +1,6 @@ extern crate cargotest; extern crate hamcrest; -use std::path::MAIN_SEPARATOR as SEP; - use cargotest::support::{execs, project}; use hamcrest::{assert_that}; @@ -22,12 +20,11 @@ fn rustdoc_simple() { .with_status(0) .with_stderr(format!("\ [DOCUMENTING] foo v0.0.1 ({url}) -[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \ - -o {dir}{sep}target{sep}doc \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` +[RUNNING] `rustdoc src[/]lib.rs --crate-name foo \ + -o {dir}[/]target[/]doc \ + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = p.root().display(), url = p.url()))); +", dir = p.root().display(), url = p.url()))); } #[test] @@ -46,13 +43,12 @@ fn rustdoc_args() { .with_status(0) .with_stderr(format!("\ [DOCUMENTING] foo v0.0.1 ({url}) -[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \ - -o {dir}{sep}target{sep}doc \ +[RUNNING] `rustdoc src[/]lib.rs --crate-name foo \ + -o {dir}[/]target[/]doc \ --no-defaults \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = p.root().display(), url = p.url()))); +", dir = p.root().display(), url = p.url()))); } @@ -90,16 +86,15 @@ fn rustdoc_foo_with_bar_dependency() { .with_status(0) .with_stderr(format!("\ [COMPILING] bar v0.0.1 ([..]) -[RUNNING] `rustc [..]bar{sep}src{sep}lib.rs [..]` +[RUNNING] `rustc [..]bar[/]src[/]lib.rs [..]` [DOCUMENTING] foo v0.0.1 ({url}) -[RUNNING] `rustdoc src{sep}lib.rs --crate-name foo \ - -o {dir}{sep}target{sep}doc \ +[RUNNING] `rustdoc src[/]lib.rs --crate-name foo \ + -o {dir}[/]target[/]doc \ --no-defaults \ - -L dependency={dir}{sep}target{sep}debug{sep}deps \ + -L dependency={dir}[/]target[/]debug[/]deps \ --extern [..]` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = foo.root().display(), url = foo.url()))); +", dir = foo.root().display(), url = foo.url()))); } #[test] @@ -138,13 +133,12 @@ fn rustdoc_only_bar_dependency() { .with_status(0) .with_stderr(format!("\ [DOCUMENTING] bar v0.0.1 ([..]) -[RUNNING] `rustdoc [..]bar{sep}src{sep}lib.rs --crate-name bar \ - -o {dir}{sep}target{sep}doc \ +[RUNNING] `rustdoc [..]bar[/]src[/]lib.rs --crate-name bar \ + -o {dir}[/]target[/]doc \ --no-defaults \ - -L dependency={dir}{sep}target{sep}debug{sep}deps` + -L dependency={dir}[/]target[/]debug[/]deps` [FINISHED] debug [unoptimized + debuginfo] target(s) in [..] -", sep = SEP, - dir = foo.root().display()))); +", dir = foo.root().display()))); }