Skip to content

Commit

Permalink
Auto merge of #2742 - alexcrichton:new-error-format, r=wycats
Browse files Browse the repository at this point in the history
Fix tests for RUST_NEW_ERROR_FORMAT

A few tests were a bit too strict in the output they were looking for, this
instead relaxes some assertions to just what we're interested in.
  • Loading branch information
bors committed May 27, 2016
2 parents 5f2c4b1 + d38bb34 commit 212cca9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
7 changes: 3 additions & 4 deletions tests/build-script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,9 @@ fn build_deps_not_for_normal() {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101)
.with_stderr_contains("\
[..]lib.rs[..] error: can't find crate for `aaaaa`[..]
[..]lib.rs[..] extern crate aaaaa;
[..] ^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
[..]can't find crate for `aaaaa`[..]
")
.with_stderr_contains("\
[ERROR] Could not compile `foo`.
Caused by:
Expand Down
24 changes: 5 additions & 19 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ fn cargo_compile_with_invalid_code() {
execs()
.with_status(101)
.with_stderr_contains("\
src[..]foo.rs:1:1: 1:8 error: expected item[..]found `invalid`
src[..]foo.rs:1 invalid rust code!
^~~~~~~
")
.with_stderr_contains("\
[ERROR] Could not compile `foo`.
To learn more, run the command again with --verbose.\n"));
Expand Down Expand Up @@ -282,13 +277,8 @@ fn cargo_compile_with_warnings_in_the_root_package() {
.file("src/foo.rs", "fn main() {} fn dead() {}");

assert_that(p.cargo_process("build"),
execs()
.with_stderr("\
[COMPILING] foo [..]
src[..]foo.rs:1:14: 1:26 warning: function is never used: `dead`, \
#[warn(dead_code)] on by default
src[..]foo.rs:1 fn main() {} fn dead() {}
[..] ^~~~~~~~~~~~
execs().with_stderr_contains("\
[..]function is never used: `dead`[..]
"));
}

Expand Down Expand Up @@ -333,13 +323,9 @@ fn cargo_compile_with_warnings_in_a_dep_package() {
"#);

assert_that(p.cargo_process("build"),
execs().with_stderr(&format!("\
[COMPILING] bar v0.5.0 ({url}/bar)
[..]warning: function is never used: `dead`[..]
[..]fn dead() {{}}
[..]^~~~~~~~~~~~
[COMPILING] foo v0.5.0 ({url})
", url = p.url())));
execs().with_stderr_contains("\
[..]function is never used: `dead`[..]
"));

assert_that(&p.bin("foo"), existing_file());

Expand Down
2 changes: 1 addition & 1 deletion tests/cross-compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ fn platform_specific_dependencies_do_not_leak() {
assert_that(p.cargo_process("build").arg("-v").arg("--target").arg(&target),
execs().with_status(101)
.with_stderr_contains("\
[..] error: can't find crate for `d2`[..]"));
[..] can't find crate for `d2`[..]"));
}

#[test]
Expand Down
5 changes: 1 addition & 4 deletions tests/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,7 @@ fn compile_failure() {
p.build();

assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr("\
[COMPILING] foo v0.1.0 [..]
error: main function not found
error: aborting due to previous error
execs().with_status(101).with_stderr_contains("\
[ERROR] failed to compile `foo v0.1.0 (file://[..])`, intermediate artifacts can be \
found at `[..]target`
Expand Down

0 comments on commit 212cca9

Please sign in to comment.