Skip to content

Commit

Permalink
Auto merge of #5852 - dwijnand:exit-code-0, r=alexcrichton
Browse files Browse the repository at this point in the history
Default test support's Execs to exit code 0

Refs #5742
  • Loading branch information
bors committed Aug 3, 2018
2 parents 67c4796 + b1d6a7e commit 135ef53
Show file tree
Hide file tree
Showing 72 changed files with 1,295 additions and 1,536 deletions.
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ call to `execs()`:
// Before
assert_that(
p.cargo("run"),
execs().with_status(0)
execs()
);

// After
assert_that(
p.cargo("run"),
execs().stream().with_status(0)
execs().stream()
);
```

Expand Down
27 changes: 13 additions & 14 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn depend_on_alt_registry() {

assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[DOWNLOADING] bar v0.0.1 (registry `file://[..]`)
Expand All @@ -74,13 +74,13 @@ fn depend_on_alt_registry() {

assert_that(
p.cargo("clean").masquerade_as_nightly_cargo(),
execs().with_status(0),
execs(),
);

// Don't download a second time
assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[COMPILING] bar v0.0.1 (registry `file://[..]`)
[COMPILING] foo v0.0.1 ({dir})
Expand Down Expand Up @@ -120,7 +120,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {

assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
Expand Down Expand Up @@ -165,7 +165,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {

assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
Expand Down Expand Up @@ -210,7 +210,7 @@ fn depend_on_alt_registry_depends_on_crates_io() {

assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[UPDATING] registry `{alt_reg}`
[UPDATING] registry `{reg}`
Expand Down Expand Up @@ -255,7 +255,7 @@ fn registry_and_path_dep_works() {

assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs().with_status(0).with_stderr(&format!(
execs().with_stderr(&format!(
"\
[COMPILING] bar v0.0.1 ({dir}/bar)
[COMPILING] foo v0.0.1 ({dir})
Expand Down Expand Up @@ -355,7 +355,7 @@ fn publish_with_registry_dependency() {
.arg("alternative")
.arg("TOKEN")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);

assert_that(
Expand All @@ -364,7 +364,7 @@ fn publish_with_registry_dependency() {
.arg("--registry")
.arg("alternative")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);
}

Expand Down Expand Up @@ -400,7 +400,6 @@ fn alt_registry_and_crates_io_deps() {
assert_that(
p.cargo("build").masquerade_as_nightly_cargo(),
execs()
.with_status(0)
.with_stderr_contains(format!(
"[UPDATING] registry `{}`",
registry::alt_registry()
Expand Down Expand Up @@ -467,7 +466,7 @@ fn publish_to_alt_registry() {
.arg("alternative")
.arg("TOKEN")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);

// Now perform the actual publish
Expand All @@ -477,7 +476,7 @@ fn publish_to_alt_registry() {
.arg("--registry")
.arg("alternative")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);

// Ensure that the crate is uploaded
Expand Down Expand Up @@ -516,7 +515,7 @@ fn publish_with_crates_io_dep() {
.arg("alternative")
.arg("TOKEN")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);

assert_that(
Expand All @@ -525,7 +524,7 @@ fn publish_with_crates_io_dep() {
.arg("--registry")
.arg("alternative")
.arg("-Zunstable-options"),
execs().with_status(0),
execs(),
);
}

Expand Down
26 changes: 13 additions & 13 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fn default_cargo_config_jobs() {
"#,
)
.build();
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
assert_that(p.cargo("build").arg("-v"), execs());
}

#[test]
Expand All @@ -190,7 +190,7 @@ fn good_cargo_config_jobs() {
"#,
)
.build();
assert_that(p.cargo("build").arg("-v"), execs().with_status(0));
assert_that(p.cargo("build").arg("-v"), execs());
}

#[test]
Expand Down Expand Up @@ -371,7 +371,7 @@ fn bad_dependency_in_lockfile() {
)
.build();

assert_that(p.cargo("build"), execs().with_status(0));
assert_that(p.cargo("build"), execs());
}

#[test]
Expand Down Expand Up @@ -683,7 +683,7 @@ fn unused_keys() {

assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: unused manifest key: target.foo.bar
[COMPILING] foo v0.1.0 (file:///[..])
Expand All @@ -710,7 +710,7 @@ warning: unused manifest key: target.foo.bar

assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: unused manifest key: profile.debug
warning: use `[profile.dev]` to configure debug builds
Expand All @@ -735,7 +735,7 @@ warning: use `[profile.dev]` to configure debug builds
.build();
assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: unused manifest key: project.bulid
[COMPILING] foo [..]
Expand Down Expand Up @@ -763,7 +763,7 @@ warning: unused manifest key: project.bulid
.build();
assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: unused manifest key: lib.build
[COMPILING] foo [..]
Expand All @@ -789,7 +789,7 @@ fn unused_keys_in_virtual_manifest() {
.build();
assert_that(
p.cargo("build --all"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: unused manifest key: workspace.bulid
[COMPILING] bar [..]
Expand Down Expand Up @@ -821,7 +821,7 @@ fn empty_dependencies() {

assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr_contains(
execs().with_stderr_contains(
"\
warning: dependency (bar) specified without providing a local path, Git repository, or version \
to use. This will be considered an error in future versions
Expand All @@ -839,7 +839,7 @@ fn invalid_toml_historically_allowed_is_warned() {

assert_that(
p.cargo("build"),
execs().with_status(0).with_stderr(
execs().with_stderr(
"\
warning: TOML file found which contains invalid syntax and will soon not parse
at `[..]config`.
Expand Down Expand Up @@ -877,7 +877,7 @@ fn ambiguous_git_reference() {

assert_that(
p.cargo("build").arg("-v"),
execs().with_stderr_contains(
execs().with_status(101).with_stderr_contains(
"\
[WARNING] dependency (bar) specification is ambiguous. \
Only one of `branch`, `tag` or `rev` is allowed. \
Expand Down Expand Up @@ -1097,7 +1097,7 @@ fn both_git_and_path_specified() {

assert_that(
foo.cargo("build").arg("-v"),
execs().with_stderr_contains(
execs().with_status(101).with_stderr_contains(
"\
[WARNING] dependency (bar) specification is ambiguous. \
Only one of `git` or `path` is allowed. \
Expand Down Expand Up @@ -1162,7 +1162,7 @@ fn ignored_git_revision() {

assert_that(
foo.cargo("build").arg("-v"),
execs().with_stderr_contains(
execs().with_status(101).with_stderr_contains(
"\
[WARNING] key `branch` is ignored for dependency (bar). \
This will be considered an error in future versions",
Expand Down
Loading

0 comments on commit 135ef53

Please sign in to comment.