Migrate run-make/rustdoc-scrape-examples-macros
to rmake.rs
· rust-lang/rust@fc76015 (original) (raw)
File tree
3 files changed
lines changed
- tests/run-make/rustdoc-scrape-examples-macros
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -233,7 +233,6 @@ run-make/rlib-format-packed-bundled-libs/Makefile | ||
233 | 233 | run-make/rmeta-preferred/Makefile |
234 | 234 | run-make/rustc-macro-dep-files/Makefile |
235 | 235 | run-make/rustdoc-io-error/Makefile |
236 | -run-make/rustdoc-scrape-examples-macros/Makefile | |
237 | 236 | run-make/rustdoc-verify-output-files/Makefile |
238 | 237 | run-make/rustdoc-with-output-option/Makefile |
239 | 238 | run-make/rustdoc-with-short-out-dir-option/Makefile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
1 | +//@ ignore-cross-compile | |
2 | + | |
3 | +use run_make_support::{htmldocck, rustc, rustdoc, tmp_dir}; | |
4 | + | |
5 | +fn main() { | |
6 | +let tmp_dir = tmp_dir(); | |
7 | +let out_dir = tmp_dir.join("rustdoc"); | |
8 | +let ex_dir = tmp_dir.join("ex.calls"); | |
9 | +let proc_crate_name = "foobar_macro"; | |
10 | +let crate_name = "foobar"; | |
11 | + | |
12 | +let dylib_name = String::from_utf8( | |
13 | +rustc() | |
14 | +.crate_name(proc_crate_name) | |
15 | +.crate_type("dylib") | |
16 | +.arg("--print") | |
17 | +.arg("file-names") | |
18 | +.arg("-") | |
19 | +.command_output() | |
20 | +.stdout, | |
21 | +) | |
22 | +.unwrap(); | |
23 | + | |
24 | +rustc() | |
25 | +.input("src/proc.rs") | |
26 | +.crate_name(proc_crate_name) | |
27 | +.edition("2021") | |
28 | +.crate_type("proc-macro") | |
29 | +.emit("dep-info,link") | |
30 | +.run(); | |
31 | +rustc() | |
32 | +.input("src/lib.rs") | |
33 | +.crate_name(crate_name) | |
34 | +.edition("2021") | |
35 | +.crate_type("lib") | |
36 | +.emit("dep-info,link") | |
37 | +.run(); | |
38 | + | |
39 | +rustdoc() | |
40 | +.input("examples/ex.rs") | |
41 | +.crate_name("ex") | |
42 | +.crate_type("bin") | |
43 | +.output(&out_dir) | |
44 | +.extern_(crate_name, tmp_dir.join(format!("lib{crate_name}.rlib"))) | |
45 | +.extern_(proc_crate_name, tmp_dir.join(dylib_name.trim())) | |
46 | +.arg("-Zunstable-options") | |
47 | +.arg("--scrape-examples-output-path") | |
48 | +.arg(&ex_dir) | |
49 | +.arg("--scrape-examples-target-crate") | |
50 | +.arg(crate_name) | |
51 | +.run(); | |
52 | + | |
53 | +rustdoc() | |
54 | +.input("src/lib.rs") | |
55 | +.crate_name(crate_name) | |
56 | +.crate_type("lib") | |
57 | +.output(&out_dir) | |
58 | +.arg("-Zunstable-options") | |
59 | +.arg("--with-examples") | |
60 | +.arg(&ex_dir) | |
61 | +.run(); | |
62 | + | |
63 | +assert!(htmldocck().arg(out_dir).arg("src/lib.rs").status().unwrap().success()); | |
64 | +} |