Skip to content

Commit a481387

Browse files
committed
test(docscrape): must fail with bad build script
1 parent 389c03d commit a481387

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testsuite/docscrape.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,43 @@ warning: `foo` (example \"ex2\") generated 1 warning
366366
.run();
367367
}
368368

369+
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
370+
fn fail_bad_build_script() {
371+
// See rust-lang/cargo#11623
372+
let p = project()
373+
.file(
374+
"Cargo.toml",
375+
r#"
376+
[package]
377+
name = "foo"
378+
version = "0.0.1"
379+
"#,
380+
)
381+
.file("src/lib.rs", "")
382+
.file("build.rs", "fn main() { panic!(\"You shall not pass\")}")
383+
.file("examples/ex.rs", "fn main() {}")
384+
.build();
385+
386+
// `cargo doc` fails
387+
p.cargo("doc")
388+
.with_status(101)
389+
.with_stderr_contains("[..]You shall not pass[..]")
390+
.run();
391+
392+
// FIXME: scrape examples should fail whenever `cargo doc` fails.
393+
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
394+
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
395+
.with_stderr(
396+
"\
397+
[COMPILING] foo v0.0.1 ([CWD])
398+
[SCRAPING] foo v0.0.1 ([CWD])
399+
[DOCUMENTING] foo v0.0.1 ([CWD])
400+
[FINISHED] dev [..]
401+
",
402+
)
403+
.run();
404+
}
405+
369406
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
370407
fn no_fail_bad_example() {
371408
let p = project()

0 commit comments

Comments
 (0)