Skip to content

Commit 509bf99

Browse files
committed
Auto merge of #6027 - GuillaumeGomez:remove-error-code-check, r=alexcrichton
Remove error code check in doc test Needed by rust-lang/rust#53933 cc @alexcrichton
2 parents 3fc546c + 2fc6b3e commit 509bf99

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

tests/testsuite/build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,10 +3938,6 @@ fn inferred_benchmarks() {
39383938

39393939
#[test]
39403940
fn target_edition() {
3941-
if !is_nightly() {
3942-
// --edition is nightly-only
3943-
return;
3944-
}
39453941
let p = project()
39463942
.file(
39473943
"Cargo.toml",
@@ -3957,6 +3953,7 @@ fn target_edition() {
39573953
.build();
39583954

39593955
p.cargo("build -v")
3956+
.without_status() // passes on nightly, fails on stable, b/c --edition is nightly-only
39603957
.with_stderr_contains(
39613958
"\
39623959
[COMPILING] foo v0.0.1 ([..])

tests/testsuite/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ fn output_not_captured() {
635635
).build();
636636

637637
p.cargo("doc")
638-
.with_status(101)
638+
.without_status()
639639
.with_stderr_contains("1 | ☃")
640640
.with_stderr_contains(r"error: unknown start of token: \u{2603}")
641641
.run();

tests/testsuite/package.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,6 @@ fn package_two_kinds_of_deps() {
932932

933933
#[test]
934934
fn test_edition() {
935-
if !is_nightly() {
936-
// --edition is nightly-only
937-
return;
938-
}
939935
let p = project()
940936
.file(
941937
"Cargo.toml",
@@ -951,10 +947,11 @@ fn test_edition() {
951947
.build();
952948

953949
p.cargo("build -v").masquerade_as_nightly_cargo()
954-
// --edition is still in flux and we're not passing -Zunstable-options
955-
// from Cargo so it will probably error. Only partially match the output
956-
// until stuff stabilizes
957-
.with_stderr_contains("\
950+
.without_status() // passes on nightly, fails on stable, b/c --edition is nightly-only
951+
// --edition is still in flux and we're not passing -Zunstable-options
952+
// from Cargo so it will probably error. Only partially match the output
953+
// until stuff stabilizes
954+
.with_stderr_contains("\
958955
[COMPILING] foo v0.0.1 ([..])
959956
[RUNNING] `rustc [..]--edition=2018 [..]
960957
").run();

tests/testsuite/support/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,14 @@ impl Execs {
566566
self
567567
}
568568

569+
/// Remove exit code check for the process.
570+
///
571+
/// By default, the expected exit code is `0`.
572+
pub fn without_status(&mut self) -> &mut Self {
573+
self.expect_exit_code = None;
574+
self
575+
}
576+
569577
/// Verify that stdout contains the given contiguous lines somewhere in
570578
/// its output.
571579
/// See `lines_match` for supported patterns.

0 commit comments

Comments
 (0)