Skip to content

Commit b97310c

Browse files
Add run-make test for rustdoc --emit=dep-info option
1 parent 46a39f0 commit b97310c

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

tests/run-make/rustdoc-default-output/output-default.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Options:
153153
--generate-redirect-map
154154
Generate JSON file at the top level instead of
155155
generating HTML redirection files
156-
--emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific]
156+
--emit [unversioned-shared-resources,toolchain-shared-resources,invocation-specific,dep-info]
157157
Comma separated list of types of output for rustdoc to
158158
emit
159159
--no-run Compile doctests without running them
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include!("foo.rs");
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blablabla
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub fn foo() {}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![crate_name = "foo"]
2+
3+
#[cfg_attr(doc, doc = include_str!("doc.md"))]
4+
pub struct Bar;
5+
6+
mod bar;
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This is a simple smoke test for rustdoc's `--emit dep-info` feature. It prints out
2+
// information about dependencies in a Makefile-compatible format, as a `.d` file.
3+
4+
use run_make_support::assertion_helpers::assert_contains;
5+
use run_make_support::{path, rfs, rustdoc};
6+
7+
fn main() {
8+
// We're only emitting dep info, so we shouldn't be running static analysis to
9+
// figure out that this program is erroneous.
10+
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info").run();
11+
12+
let content = rfs::read_to_string("foo.d");
13+
assert_contains(&content, "lib.rs:");
14+
assert_contains(&content, "foo.rs:");
15+
assert_contains(&content, "bar.rs:");
16+
assert_contains(&content, "doc.md:");
17+
18+
// Now we check that we can provide a file name to the `dep-info` argument.
19+
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run();
20+
assert!(path("bla.d").exists());
21+
}

0 commit comments

Comments
 (0)