Rollup merge of #124698 - JoverZhang:test-rustdoc-determinism, r=jieyouxu
Rewrite `rustdoc-determinism` test in Rust Rewrite the `rustdoc-determinism` test from #121876. r? `@jieyouxu`
This commit is contained in:
commit
b8711373cd
@ -245,7 +245,6 @@ run-make/rlib-format-packed-bundled-libs-3/Makefile
|
||||
run-make/rlib-format-packed-bundled-libs/Makefile
|
||||
run-make/rmeta-preferred/Makefile
|
||||
run-make/rustc-macro-dep-files/Makefile
|
||||
run-make/rustdoc-determinism/Makefile
|
||||
run-make/rustdoc-error-lines/Makefile
|
||||
run-make/rustdoc-io-error/Makefile
|
||||
run-make/rustdoc-map-file/Makefile
|
||||
|
@ -1,16 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
# Assert that the search index is generated deterministically, regardless of the
|
||||
# order that crates are documented in.
|
||||
|
||||
# ignore-windows
|
||||
# Uses `diff`.
|
||||
|
||||
all:
|
||||
$(RUSTDOC) foo.rs -o $(TMPDIR)/foo_first
|
||||
$(RUSTDOC) bar.rs -o $(TMPDIR)/foo_first
|
||||
|
||||
$(RUSTDOC) bar.rs -o $(TMPDIR)/bar_first
|
||||
$(RUSTDOC) foo.rs -o $(TMPDIR)/bar_first
|
||||
|
||||
diff $(TMPDIR)/foo_first/search-index.js $(TMPDIR)/bar_first/search-index.js
|
18
tests/run-make/rustdoc-determinism/rmake.rs
Normal file
18
tests/run-make/rustdoc-determinism/rmake.rs
Normal file
@ -0,0 +1,18 @@
|
||||
use run_make_support::{diff, rustc, rustdoc, tmp_dir};
|
||||
|
||||
/// Assert that the search index is generated deterministically, regardless of the
|
||||
/// order that crates are documented in.
|
||||
fn main() {
|
||||
let dir_first = tmp_dir().join("first");
|
||||
rustdoc().out_dir(&dir_first).input("foo.rs").run();
|
||||
rustdoc().out_dir(&dir_first).input("bar.rs").run();
|
||||
|
||||
let dir_second = tmp_dir().join("second");
|
||||
rustdoc().out_dir(&dir_second).input("bar.rs").run();
|
||||
rustdoc().out_dir(&dir_second).input("foo.rs").run();
|
||||
|
||||
diff()
|
||||
.expected_file(dir_first.join("search-index.js"))
|
||||
.actual_file(dir_second.join("search-index.js"))
|
||||
.run();
|
||||
}
|
Loading…
Reference in New Issue
Block a user