execs()
.with_status(0)
.with_stderr_contains(format!(
- "\
- [UPDATING] registry `{}`",
+ "[UPDATING] registry `{}`",
registry::alt_registry()
))
- .with_stderr_contains(&format!(
- "\
- [UPDATING] registry `{}`",
- registry::registry()
- ))
- .with_stderr_contains(
- "\
- [DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [COMPILING] crates_io_dep v0.0.1",
- )
- .with_stderr_contains(&format!(
- "\
- [COMPILING] foo v0.0.1 ({})",
- p.url()
- ))
+ .with_stderr_contains(&format!("[UPDATING] registry `{}`", registry::registry()))
+ .with_stderr_contains("[DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)")
+ .with_stderr_contains("[DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)")
+ .with_stderr_contains("[COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)")
+ .with_stderr_contains("[COMPILING] crates_io_dep v0.0.1")
+ .with_stderr_contains(&format!("[COMPILING] foo v0.0.1 ({})", p.url()))
.with_stderr_contains(
- "\
- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs",
+ "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs",
),
)
}
.build();
assert_that(
p.cargo("build").arg("-v"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] build.jobs must be positive, but found -1 in [..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] build.jobs must be positive, but found -1 in [..]"),
);
}
assert_that(
p.cargo("build").arg("-v"),
execs().with_status(101).with_stderr_contains(
- "\
-error: failed to run `rustc` to learn about target-specific information
-",
+ "error: failed to run `rustc` to learn about target-specific information",
),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-error: no source URL specified for `source.foo`, need [..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: no source URL specified for `source.foo`, need [..]"),
);
}
assert_that(
p.cargo("build"),
execs().with_status(101).with_stderr(
- "\
-error: expected a string, but found a array for `source.crates-io.replace-with` in [..]
-",
+ "error: expected a string, but found a array for `source.crates-io.replace-with` in [..]",
),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-error: more than one source URL specified for `source.foo`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: more than one source URL specified for `source.foo`"),
);
}
.arg("foo")
.cwd(p.root().parent().unwrap()),
execs().with_status(1).with_stdout(
- "\
- {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
+ "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
",
),
);
.arg("foo/bar")
.cwd(p.root().parent().unwrap()),
execs().with_status(1).with_stdout(
- "\
- {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
+ "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
",
),
);
.arg("foo/bar/baz")
.cwd(p.root().parent().unwrap()),
execs().with_status(1).with_stdout(
- "\
- {\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
+ "{\"invalid\":\"the manifest-path must be a path to a Cargo.toml file\"}\
",
),
);
.arg("foo/bar/baz/Cargo.toml")
.cwd(p.root().parent().unwrap()),
execs().with_status(1).with_stdout(
- "\
- {\"invalid\":\"manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\"}\
+ "{\"invalid\":\"manifest path `foo[..]bar[..]baz[..]Cargo.toml` does not exist\"}\
",
),
);
.arg("--test-threads=1"),
execs()
.with_status(101)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("running 2 tests")
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("test bench_hello [..]")
.with_stdout_contains("test bench_nope [..]"),
);
p.cargo("bench").arg("-p").arg("bar").arg("-p").arg("baz"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]bbaz-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bbaz-[..][EXE]")
.with_stdout_contains("test bench_baz ... bench: [..]")
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]bbar-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bbar-[..][EXE]")
.with_stdout_contains("test bench_bar ... bench: [..]"),
);
}
p.cargo("bench").arg("--all"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]")
.with_stdout_contains("test bench_bar ... bench: [..]")
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("test bench_foo ... bench: [..]"),
);
}
p.cargo("bench").arg("--all"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]")
.with_stdout_contains("test bench_bar ... bench: [..]")
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("test bench_foo ... bench: [..]"),
);
}
p.cargo("bench"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]bar-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]bar-[..][EXE]")
.with_stdout_contains("test bench_bar ... bench: [..]")
- .with_stderr_contains(
- "\
- [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]")
.with_stdout_contains("test bench_foo ... bench: [..]"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] could not find `Cargo.toml` in `[..]` or any parent directory"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr_contains(
- "\
-[..]function is never used: `dead`[..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[..]function is never used: `dead`[..]"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr_contains(
- "\
-[..]function is never used: `dead`[..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[..]function is never used: `dead`[..]"),
);
assert_that(&p.bin("foo"), existing_file());
assert_that(
p.cargo("build").arg("--bin").arg("bin.rs"),
- execs().with_status(101).with_stderr(
- "\
- [ERROR] no bin target named `bin.rs`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no bin target named `bin.rs`"),
);
assert_that(
assert_that(
p.cargo("build").arg("--example").arg("example.rs"),
- execs().with_status(101).with_stderr(
- "\
- [ERROR] no example target named `example.rs`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no example target named `example.rs`"),
);
assert_that(
assert_that(
p.cargo("build").arg("-v"),
- execs().with_status(101).with_stderr_contains(
- "\
-[..] can't find crate for `bbbbb`[..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("[..] can't find crate for `bbbbb`[..]"),
);
}
assert_that(
p.cargo("build").arg("-p").arg("notAValidDep"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] package id specification `notAValidDep` matched no packages
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] package id specification `notAValidDep` matched no packages"),
);
assert_that(
.arg("d1")
.arg("-p")
.arg("notAValidDep"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] package id specification `notAValidDep` matched no packages
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] package id specification `notAValidDep` matched no packages"),
);
}
assert_that(
p.cargo("build"),
execs().with_status(101).with_stderr_contains(
- "\
-[..]found duplicate binary name foo, but all binary targets must have a unique name[..]
-",
+ "[..]found duplicate binary name foo, but all binary targets must have a unique name[..]",
),
);
}
--emit=dep-info,link[..]",
)
.with_stderr_contains(
- "\
- [RUNNING] `rustc --crate-name t1 tests[/]t1.rs --emit=dep-info,link[..]",
+ "[RUNNING] `rustc --crate-name t1 tests[/]t1.rs --emit=dep-info,link[..]",
)
.with_stderr_contains(
"\
assert_that(
p.cargo("build").arg("--jobs").arg("over9000"),
- execs().with_status(1).with_stderr(
- "\
-error: Invalid value: could not parse `over9000` as a number
-",
- ),
+ execs()
+ .with_status(1)
+ .with_stderr("error: Invalid value: could not parse `over9000` as a number"),
);
}
execs()
.with_status(101)
.with_stderr_contains(&format!(
- "\
-[UPDATING] git repository `https://{addr}/foo/bar`
-",
+ "[UPDATING] git repository `https://{addr}/foo/bar`",
addr = addr
))
.with_stderr_contains(&format!(
execs()
.with_status(101)
.with_stderr_contains(&format!(
- "\
-[UPDATING] git repository `ssh://{addr}/foo/bar`
-",
+ "[UPDATING] git repository `ssh://{addr}/foo/bar`",
addr = addr
))
.with_stderr_contains(
p.cargo("build").arg("-v").arg("--target").arg(&target),
execs()
.with_status(101)
- .with_stderr_contains(
- "\
-[..]can't find crate for `aaaaa`[..]
-",
- )
+ .with_stderr_contains("[..]can't find crate for `aaaaa`[..]")
.with_stderr_contains(
"\
[ERROR] Could not compile `foo`.
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target[/]debug[/]foo`",
)
- .with_stdout(
- "\
-Hello, World!
-",
- ),
+ .with_stdout("Hello, World!"),
);
assert_that(p.cargo("test"), execs().with_status(0));
assert_that(
p.cargo("test").arg("-v"),
execs().with_status(0).with_stderr_contains(
- "\
-[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`
-",
+ "[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`",
),
);
}
assert_that(
p.cargo("build").arg("-v"),
- execs().with_status(0).with_stderr_contains(
- "\
-[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[RUNNING] `rustc [..] -L native=foo -L native=bar[..]`"),
);
}
assert_that(
p.cargo("build").arg("-vv"),
- execs()
- .with_status(0)
- .with_stdout(
- "\
-stdout
-",
- )
- .with_stderr(
- "\
+ execs().with_status(0).with_stdout("stdout").with_stderr(
+ "\
[COMPILING] foo v0.5.0 ([..])
[RUNNING] `rustc [..]`
[RUNNING] `[..]`
[RUNNING] `rustc [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
- ),
+ ),
);
}
assert_that(
p.cargo("build").arg("-v"),
- execs().with_status(0).with_stderr_contains(
- "\
-[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[RUNNING] `rustc --crate-name foo [..] [..] -L foo[..]`"),
);
}
);
assert_that(
p.cargo("build").env("FOO", "baz"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
assert_that(
p.cargo("build"),
);
assert_that(
p.cargo("build").env("FOO", "bar"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
sleep_ms(1000);
File::create(p.root().join("foo")).unwrap();
assert_that(
cargo_process().arg("--explain").arg("E0001"),
execs().with_status(0).with_stdout_contains(
- "\
- This error suggests that the expression arm corresponding to the noted pattern",
+ "This error suggests that the expression arm corresponding to the noted pattern",
),
);
}
.build();
assert_that(
p.cargo("build").arg("-Zprint-im-a-teapot"),
- execs().with_status(101).with_stderr(
- "\
-error: the `-Z` flag is only accepted on the nightly channel of Cargo
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: the `-Z` flag is only accepted on the nightly channel of Cargo"),
);
assert_that(
p.cargo("build").masquerade_as_nightly_cargo().arg("-Zarg"),
- execs().with_status(101).with_stderr(
- "\
-error: unknown `-Z` flag specified: arg
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: unknown `-Z` flag specified: arg"),
);
assert_that(
assert_that(
p.cargo("publish").masquerade_as_nightly_cargo(),
execs().with_status(101).with_stderr(
- "\
-error: cannot publish crates which activate nightly-only cargo features to crates.io
-",
+ "error: cannot publish crates which activate nightly-only cargo features to crates.io",
),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
}
assert_that(
bad,
execs().with_status(101).with_stderr_contains(
- "\
-[ERROR] binary `foo[..]` already exists in destination as part of `[..]`
-",
+ "[ERROR] binary `foo[..]` already exists in destination as part of `[..]`",
),
);
assert_that(
good,
- execs().with_status(0).with_stderr_contains(
- "\
-warning: be sure to add `[..]` to your PATH [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("warning: be sure to add `[..]` to your PATH [..]"),
);
assert_that(cargo_home(), has_installed_exe("foo"));
execs()
.with_status(0)
.with_stderr_contains(&format!(
- "\
- [COMPILING] d1 v0.0.0 ({url}/d1)",
+ "[COMPILING] d1 v0.0.0 ({url}/d1)",
url = p.url()
))
- .with_stderr_contains(&format!("\
-[RUNNING] `rustc [..] d1[/]build.rs [..] --out-dir {dir}[/]target[/]debug[/]build[/]d1-[..]`",
+ .with_stderr_contains(&format!("[RUNNING] `rustc [..] d1[/]build.rs [..] --out-dir {dir}[/]target[/]debug[/]build[/]d1-[..]`",
dir = p.root().display()))
.with_stderr_contains(&format!(
- "\
- [RUNNING] `{dir}[/]target[/]debug[/]build[/]d1-[..][/]build-script-build`",
+ "[RUNNING] `{dir}[/]target[/]debug[/]build[/]d1-[..][/]build-script-build`",
dir = p.root().display()
))
.with_stderr_contains(
- "\
- [RUNNING] `rustc [..] d1[/]src[/]lib.rs [..]`",
+ "[RUNNING] `rustc [..] d1[/]src[/]lib.rs [..]`",
)
.with_stderr_contains(&format!(
- "\
- [COMPILING] d2 v0.0.0 ({url}/d2)",
+ "[COMPILING] d2 v0.0.0 ({url}/d2)",
url = p.url()
))
.with_stderr_contains(&format!(
host = host
))
.with_stderr_contains(&format!(
- "\
- [COMPILING] foo v0.0.0 ({url})",
+ "[COMPILING] foo v0.0.0 ({url})",
url = p.url()
))
.with_stderr_contains(&format!("\
assert_that(
p.cargo("build").arg("-v").arg("--target").arg(&target),
- execs().with_status(101).with_stderr_contains(
- "\
- [..] can't find crate for `d2`[..]",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("[..] can't find crate for `d2`[..]"),
);
}
assert_that(
p.cargo("build").arg("--features").arg("test"),
- execs().with_status(101).with_stderr(
- "\
- error: Package `foo v0.0.1 ([..])` does not have these features: `test`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `test`"),
);
}
assert_that(
p.cargo("build").arg("--features").arg("foo"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] feature names may not contain slashes: `foo/bar`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] feature names may not contain slashes: `foo/bar`"),
);
}
.build();
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] feature names may not contain slashes: `bar/qux`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] feature names may not contain slashes: `bar/qux`"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] Cyclic feature dependency: feature `default` depends on itself
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] Cyclic feature dependency: feature `default` depends on itself"),
);
}
// Trying to enable features of transitive dependencies is an error
assert_that(
p.cargo("build").arg("--features").arg("bar/some-feat"),
- execs().with_status(101).with_stderr(
- "\
- error: Package `foo v0.0.1 ([..])` does not have these features: `bar`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: Package `foo v0.0.1 ([..])` does not have these features: `bar`"),
);
// Hierarchical feature specification should still be disallowed
p.cargo("build")
.arg("--features")
.arg("derived/bar/some-feat"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] feature names may not contain slashes: `bar/some-feat`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] feature names may not contain slashes: `bar/some-feat`"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
assert_that(
p.cargo("build").arg("--features").arg("foo"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stdout("").with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stdout("")
+ .with_stderr("[FINISHED] [..]"),
);
}
assert_that(
p.cargo("build").cwd(&new),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
}
assert_that(
p.cargo("generate-lockfile"),
- execs().with_stderr(
- "\
-[UPDATING] registry `[..]`
-",
- ),
+ execs().with_stderr("[UPDATING] registry `[..]`"),
);
assert_that(
assert_that(
p.cargo("fetch"),
execs().with_status(0).with_stderr(&format!(
- "\
-[UPDATING] git repository `{url}`
-",
+ "[UPDATING] git repository `{url}`",
url = bar.url()
)),
);
assert_that(p.cargo("generate-lockfile"), execs().with_status(0));
assert_that(
p.cargo("update").arg("-p").arg("foo"),
- execs().with_status(0).with_stderr(&format!(
- "\
-[UPDATING] git repository `{}`
-",
- foo.url()
- )),
+ execs()
+ .with_status(0)
+ .with_stderr(&format!("[UPDATING] git repository `{}`", foo.url())),
);
}
.arg("--vcs")
.arg("none")
.env("USER", "foo"),
- execs().with_status(0).with_stderr(
- "\
-[CREATED] library project
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[CREATED] library project"),
);
assert_that(&paths::root().join("Cargo.toml"), existing_file());
.arg("none")
.env("USER", "foo")
.cwd(&path),
- execs().with_status(0).with_stderr(
- "\
-[CREATED] binary (application) project
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[CREATED] binary (application) project"),
);
assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
.env("USER", "foo")
.cwd(&path),
execs().with_status(101).with_stderr(
- "\
-[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`
-",
+ "[ERROR] cannot have a project with multiple libraries, found both `src/lib.rs` and `lib.rs`",
),
);
assert_that(
cargo_process("init").arg("foo").arg("--flag"),
execs().with_status(1).with_stderr_contains(
- "\
-error: Found argument '--flag' which wasn't expected, or isn't valid in this context
-",
+ "error: Found argument '--flag' which wasn't expected, or isn't valid in this context",
),
);
}
assert_that(
cargo_process("init").arg("/"),
execs().with_status(101).with_stderr(
- "\
-[ERROR] cannot auto-detect project name from path \"/\" ; use --name to override
-"
+ "[ERROR] cannot auto-detect project name from path \"/\" ; use --name to override"
.to_string(),
),
);
assert_that(
cargo_process("uninstall").arg("foo"),
execs().with_status(0).with_stderr(&format!(
- "\
-[REMOVING] {home}[..]bin[..]foo[..]
-",
+ "[REMOVING] {home}[..]bin[..]foo[..]",
home = cargo_home().display()
)),
);
assert_that(
cargo_process("install").arg("--path").arg(p.root()),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] no packages found with binaries or examples
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no packages found with binaries or examples"),
);
}
fn uninstall_pkg_does_not_exist() {
assert_that(
cargo_process("uninstall").arg("foo"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] package id specification `foo` matched no packages
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] package id specification `foo` matched no packages"),
);
}
assert_that(cargo_process("install").arg("foo"), execs().with_status(0));
assert_that(
cargo_process("uninstall").arg("foo").arg("--bin=bar"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] binary `bar[..]` not installed as part of `foo v0.0.1`"),
);
}
assert_that(
cargo_process("uninstall").arg("foo").arg("--bin=bar"),
- execs().with_status(0).with_stderr(
- "\
-[REMOVING] [..]bar[..]
-",
- ),
+ execs().with_status(0).with_stderr("[REMOVING] [..]bar[..]"),
);
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(
cargo_process("uninstall").arg("foo").arg("--bin=foo"),
- execs().with_status(0).with_stderr(
- "\
-[REMOVING] [..]foo[..]
-",
- ),
+ execs().with_status(0).with_stderr("[REMOVING] [..]foo[..]"),
);
assert_that(cargo_home(), is_not(has_installed_exe("foo")));
assert_that(
cargo_process("uninstall").arg("foo"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] package id specification `foo` matched no packages
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] package id specification `foo` matched no packages"),
);
}
);
assert_that(
cargo_process("fail"),
- execs().with_status(101).with_stderr_contains(
- "\
-thread '[..]' panicked at 'explicit panic', [..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("thread '[..]' panicked at 'explicit panic', [..]"),
);
}
.arg("foo")
.arg("--vers")
.arg("0.1.1"),
- execs().with_status(0).with_stderr_contains(
- "\
-[DOWNLOADING] foo v0.1.1 (registry [..])
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"),
);
}
.arg("foo")
.arg("--version")
.arg("0.1.1"),
- execs().with_status(0).with_stderr_contains(
- "\
- [DOWNLOADING] foo v0.1.1 (registry [..])
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[DOWNLOADING] foo v0.1.1 (registry [..])"),
);
}
#[test]
fn test_install_git_cannot_be_a_base_url() {
assert_that(cargo_process("install").arg("--git").arg("github.com:rust-lang-nursery/rustfmt.git"),
- execs().with_status(101).with_stderr("\
-error: invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported
-"));
+ execs().with_status(101).with_stderr("error: invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported"));
}
#[test]
fn uninstall_multiple_and_specifying_bin() {
assert_that(cargo_process("uninstall").args(&["foo", "bar"]).arg("--bin").arg("baz"),
- execs().with_status(101).with_stderr("\
-error: A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant.
-"));
+ execs().with_status(101).with_stderr("error: A binary can only be associated with a single installed package, specifying multiple specs with --bin is redundant."));
}
#[test]
);
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
assert_that(p.cargo("test"), execs().with_status(0));
}
assert_that(
p.cargo("update").arg("-v"),
- execs().with_status(0).with_stderr(
- "\
-[UPDATING] foo v0.1.0 -> v0.2.0
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[UPDATING] foo v0.1.0 -> v0.2.0"),
);
}
);
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
assert_that(p.cargo("test"), execs().with_status(0));
}
.build();
assert_that(p.cargo("metadata"),
- execs().with_stderr("\
-[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems"));
+ execs().with_stderr("[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems"));
assert_that(
p.cargo("metadata").arg("--format-version").arg("1"),
"[WARNING] spurious network error \
(2 tries remaining): [..]",
)
- .with_stderr_contains(
- "\
- [WARNING] spurious network error (1 tries remaining): [..]",
- ),
+ .with_stderr_contains("[WARNING] spurious network error (1 tries remaining): [..]"),
);
}
.arg("--vcs")
.arg("none")
.env("USER", "foo"),
- execs().with_status(0).with_stderr(
- "\
-[CREATED] library `foo` project
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[CREATED] library `foo` project"),
);
assert_that(&paths::root().join("foo"), existing_dir());
.arg("--bin")
.arg("foo")
.env("USER", "foo"),
- execs().with_status(0).with_stderr(
- "\
-[CREATED] binary (application) `foo` project
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[CREATED] binary (application) `foo` project"),
);
assert_that(&paths::root().join("foo"), existing_dir());
assert_that(
cargo_process("new").arg("foo").arg("--flag"),
execs().with_status(1).with_stderr_contains(
- "\
-error: Found argument '--flag' which wasn't expected, or isn't valid in this context
-",
+ "error: Found argument '--flag' which wasn't expected, or isn't valid in this context",
),
);
}
.arg("10-invalid")
.arg("a"),
execs().with_status(101).with_stderr(
- "\
- [ERROR] Package names starting with a digit cannot be used as a crate name",
+ "[ERROR] Package names starting with a digit cannot be used as a crate name",
),
);
}
p.cargo("update")
.arg("-p")
.arg(&format!("{}#bar", foo.url())),
- execs().with_status(0).with_stderr(
- "\
-[UPDATING] git repository `file://[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[UPDATING] git repository `file://[..]`"),
);
assert_that(
p.cargo("update")
.arg("-p")
.arg("https://github.com/rust-lang/crates.io-index#bar"),
- execs().with_status(0).with_stderr(
- "\
-[UPDATING] registry `file://[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[UPDATING] registry `file://[..]`"),
);
assert_that(p.cargo("build"), execs().with_status(0).with_stdout(""));
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr_contains(
- "\
-error: cyclic package dependency: [..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("error: cyclic package dependency: [..]"),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(
p.cargo("build"),
assert_that(p.cargo("update"), execs().with_status(0));
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
t!(t!(File::create(p.root().join("Cargo.toml"))).write_all(
assert_that(p.cargo("build"), execs().with_status(0));
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
}
// Nothing should be rebuilt, no registry should be updated.
assert_that(
p.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
}
.arg("-v")
.arg("--index")
.arg(registry().to_string()),
- execs().with_status(101).with_stderr_contains(
- "\
- [ERROR] the license file `foo` does not exist",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("[ERROR] the license file `foo` does not exist"),
);
}
assert_that(
p.cargo("update").arg("-p").arg("hyper"),
- execs().with_status(0).with_stderr(
- "\
-[UPDATING] registry `[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[UPDATING] registry `[..]`"),
);
}
p.cargo("build"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [DOWNLOADING] a v0.1.1 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [DOWNLOADING] b v0.1.1 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [DOWNLOADING] c v0.1.1 (registry `file://[..]`)",
- )
- .with_stderr_contains(
- "\
- [COMPILING] a v0.1.1",
- )
- .with_stderr_contains(
- "\
- [COMPILING] b v0.1.1",
- )
- .with_stderr_contains(
- "\
- [COMPILING] c v0.1.1",
- )
- .with_stderr_contains(
- "\
- [COMPILING] foo v0.5.0 ([..])",
- ),
+ .with_stderr_contains("[DOWNLOADING] a v0.1.1 (registry `file://[..]`)")
+ .with_stderr_contains("[DOWNLOADING] b v0.1.1 (registry `file://[..]`)")
+ .with_stderr_contains("[DOWNLOADING] c v0.1.1 (registry `file://[..]`)")
+ .with_stderr_contains("[COMPILING] a v0.1.1")
+ .with_stderr_contains("[COMPILING] b v0.1.1")
+ .with_stderr_contains("[COMPILING] c v0.1.1")
+ .with_stderr_contains("[COMPILING] foo v0.5.0 ([..])"),
);
}
assert_that(
p.cargo("build").arg("-vv"),
- execs().with_status(0).with_stderr_contains(
- "\
-[..]warning: function is never used[..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[..]warning: function is never used[..]"),
);
}
execs()
.with_status(0)
.with_stderr(format!(
- "\
- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
+ "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
))
.with_stdout(""),
);
execs()
.with_status(0)
.with_stderr(format!(
- "\
- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
+ "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
))
.with_stdout(""),
);
p.cargo("bench").arg("--no-default-features"),
execs()
.with_status(0)
- .with_stderr(format!(
- "\
- [FINISHED] release [optimized] target(s) in [..]"
- ))
+ .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]"))
.with_stdout(""),
);
p.cargo("bench").arg("--no-default-features"),
execs()
.with_status(0)
- .with_stderr(format!(
- "\
- [FINISHED] release [optimized] target(s) in [..]"
- ))
+ .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]"))
.with_stdout(""),
);
}
execs()
.with_status(0)
.with_stderr(format!(
- "\
- [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
+ "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"
))
.with_stdout(""),
);
p.cargo("bench"),
execs()
.with_status(0)
- .with_stderr(format!(
- "\
- [FINISHED] release [optimized] target(s) in [..]"
- ))
+ .with_stderr(format!("[FINISHED] release [optimized] target(s) in [..]"))
.with_stdout(""),
);
[RUNNING] `target[/]debug[/]foo[EXE]`",
dir = path2url(p.root())
))
- .with_stdout(
- "\
-hello
-",
- ),
+ .with_stdout("hello"),
);
assert_that(&p.bin("foo"), existing_file());
}
assert_that(
p.cargo("run").arg("-q").arg("-v"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] cannot set both --verbose and --quiet
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] cannot set both --verbose and --quiet"),
);
}
);
if !cfg!(unix) {
output.push_str(
- "\
-[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-",
+ "[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)",
);
}
assert_that(p.cargo("run"), execs().with_status(2).with_stderr(output));
);
if !cfg!(unix) {
output.push_str(
- "\
-[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)
-",
+ "[ERROR] process didn't exit successfully: `target[..]foo[..]` (exit code: 2)",
);
}
[RUNNING] `target[/]debug[/]a[EXE]`",
dir = path2url(p.root())
))
- .with_stdout(
- "\
-hello a.rs
-",
- ),
+ .with_stdout("hello a.rs"),
);
assert_that(
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target[/]debug[/]b[EXE]`",
)
- .with_stdout(
- "\
-hello b.rs
-",
- ),
+ .with_stdout("hello b.rs"),
);
}
[RUNNING] `target[/]debug[/]examples[/]a[EXE]`",
dir = path2url(p.root())
))
- .with_stdout(
- "\
-example
-",
- ),
+ .with_stdout("example"),
);
}
assert_that(
p.cargo("run").arg("--bins"),
execs().with_status(1).with_stderr_contains(
- "\
- error: Found argument '--bins' which wasn't expected, or isn't valid in this context",
+ "error: Found argument '--bins' which wasn't expected, or isn't valid in this context",
),
);
}
assert_that(
p.cargo("run").arg("--bin").arg("bin.rs"),
- execs().with_status(101).with_stderr(
- "\
- [ERROR] no bin target named `bin.rs`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no bin target named `bin.rs`"),
);
assert_that(
assert_that(
p.cargo("run").arg("--example").arg("example.rs"),
- execs().with_status(101).with_stderr(
- "\
- [ERROR] no example target named `example.rs`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no example target named `example.rs`"),
);
assert_that(
[RUNNING] `target[/]debug[/]main[EXE]`",
dir = path2url(p.root())
))
- .with_stdout(
- "\
-hello main.rs
-",
- ),
+ .with_stdout("hello main.rs"),
);
}
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]\n\
[RUNNING] `.[/]foo[EXE]`",
)
- .with_stdout(
- "\
-hello
-",
- ),
+ .with_stdout("hello"),
);
}
assert_that(cargo().arg("-p").arg("d1").arg("-p").arg("d2"),
execs()
.with_status(1)
- .with_stderr_contains("\
-error: The argument '--package <SPEC>' was provided more than once, but cannot be used multiple times
-"));
+ .with_stderr_contains("error: The argument '--package <SPEC>' was provided more than once, but cannot be used multiple times"));
assert_that(
cargo().arg("-p").arg("d3"),
assert_that(
p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo").arg("-v"),
- execs().with_status(0).with_stderr_contains(
- "\
-[RUNNING] `rustdoc [..] --cfg=foo[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg=foo[..]`"),
);
}
assert_that(
p.cargo("doc").arg("-v"),
- execs().with_status(0).with_stderr_contains(
- "\
-[RUNNING] `rustdoc [..] --cfg foo[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[RUNNING] `rustdoc [..] --cfg foo[..]`"),
);
}
);
assert_that(
p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=foo"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(
p.cargo("doc").env("RUSTDOCFLAGS", "--cfg=bar"),
assert_that(p1.cargo("run"), execs().with_status(0));
assert_that(
p1.cargo("build"),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] [..]
-",
- ),
+ execs().with_status(0).with_stderr("[FINISHED] [..]"),
);
}
.arg("--index")
.arg(registry().to_string()),
execs().with_status(0).with_stdout_contains(
- "\
- hoare = \"0.1.1\" # Design by contract style assertions for Rust",
+ "hoare = \"0.1.1\" # Design by contract style assertions for Rust",
),
);
}
reg = registry()
))
.with_stdout_contains(
- "\
- hoare = \"0.1.1\" # Design by contract style assertions for Rust",
+ "hoare = \"0.1.1\" # Design by contract style assertions for Rust",
),
);
}
reg = registry()
))
.with_stdout_contains(
- "\
- hoare = \"0.1.1\" # Design by contract style assertions for Rust",
+ "hoare = \"0.1.1\" # Design by contract style assertions for Rust",
),
);
}
.arg("--index")
.arg(registry().to_string()),
execs().with_status(0).with_stdout_contains(
- "\
- hoare = \"0.1.1\" # Design by contract style assertions for Rust",
+ "hoare = \"0.1.1\" # Design by contract style assertions for Rust",
),
);
}
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] [..]",
)
- .with_stdout(
- "\
-bin
-",
- ),
+ .with_stdout("bin"),
);
assert_that(&p.bin("foo"), existing_file());
}
assert_that(
p.cargo("run").arg("--example").arg("foo"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] no example target named `foo`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no example target named `foo`"),
);
assert_that(
p.cargo("run").arg("--bin").arg("foo"),
- execs().with_status(101).with_stderr(
- "\
-[ERROR] no bin target named `foo`
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("[ERROR] no bin target named `foo`"),
);
}
p.cargo("test").arg("-p").arg("d1").arg("-p").arg("d2"),
execs()
.with_status(0)
- .with_stderr_contains(
- "\
- [RUNNING] target[/]debug[/]deps[/]d1-[..][EXE]",
- )
- .with_stderr_contains(
- "\
- [RUNNING] target[/]debug[/]deps[/]d2-[..][EXE]",
- )
+ .with_stderr_contains("[RUNNING] target[/]debug[/]deps[/]d1-[..][EXE]")
+ .with_stderr_contains("[RUNNING] target[/]debug[/]deps[/]d2-[..][EXE]")
.with_stdout_contains_n("running 0 tests", 2),
);
}
assert_that(
p.cargo("build"),
- execs().with_status(101).with_stderr(
- "\
-error: root of a workspace inferred but wasn't a root: [..]
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: root of a workspace inferred but wasn't a root: [..]"),
);
}
assert_that(
p.cargo("generate-lockfile"),
- execs().with_status(0).with_stderr(
- "\
-[UPDATING] registry `[..]`
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[UPDATING] registry `[..]`"),
);
Package::new("dep1", "0.1.1").publish();
assert_that(
p.cargo("update"),
- execs().with_status(101).with_stderr(
- "\
-error: you can't generate a lockfile for an empty workspace.
-",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr("error: you can't generate a lockfile for an empty workspace."),
);
}
assert_that(
p.cargo("build").cwd(p.root().join("bar")),
- execs().with_status(101).with_stderr_contains(
- "\
- [ERROR] failed to parse manifest at `[..]`",
- ),
+ execs()
+ .with_status(101)
+ .with_stderr_contains("[ERROR] failed to parse manifest at `[..]`"),
);
}
// features are being built separately. Should not rebuild anything
assert_that(
p.cargo("build").cwd(p.root().join("caller2")),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(
p.cargo("build").cwd(p.root().join("caller1")),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
assert_that(
p.cargo("build").cwd(p.root().join("caller2")),
- execs().with_status(0).with_stderr(
- "\
-[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
-",
- ),
+ execs()
+ .with_status(0)
+ .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"),
);
}