Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ddd2ca1

Browse files
committedFeb 26, 2025
Add run-make test for rustdoc --emit=dep-info option
1 parent 46a39f0 commit ddd2ca1

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed
 
+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;
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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::path;
5+
use run_make_support::assertion_helpers::assert_contains;
6+
use run_make_support::{rfs, rustdoc};
7+
8+
fn main() {
9+
// We're only emitting dep info, so we shouldn't be running static analysis to
10+
// figure out that this program is erroneous.
11+
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info").run();
12+
13+
let content = rfs::read_to_string("foo.d");
14+
assert_contains(&content, "lib.rs:");
15+
assert_contains(&content, "foo.rs:");
16+
assert_contains(&content, "bar.rs:");
17+
assert_contains(&content, "doc.md:");
18+
19+
// Now we check that we can provide a file name to the `dep-info` argument.
20+
rustdoc().input("lib.rs").arg("-Zunstable-options").emit("dep-info=bla.d").run();
21+
assert!(path("bla.d").exists());
22+
}

0 commit comments

Comments
 (0)
Failed to load comments.