Skip to content

Commit e4fe8f0

Browse files
committed
Auto merge of #12800 - notriddle:notriddle/version-tests, r=ehuss
rustdoc: remove the word "Version" from test cases Needed for rust-lang/rust#115948 to merge. That PR gets rid of the word "Version" in rustdoc's HTML output, and it splits spaced versions on their first space, to fit in the tight horizontal spacing. This causes Cargo's test suite to fail, because it look for the word "Version", even though things are working as they should. These tests work on both current nightly and on that pull request.
2 parents c97c906 + f0d3cdf commit e4fe8f0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/testsuite/doc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2004,7 +2004,7 @@ fn crate_versions() {
20042004
let output_path = p.root().join("target/doc/foo/index.html");
20052005
let output_documentation = fs::read_to_string(&output_path).unwrap();
20062006

2007-
assert!(output_documentation.contains("Version 1.2.4"));
2007+
assert!(output_documentation.contains("1.2.4"));
20082008
}
20092009

20102010
#[cargo_test]
@@ -2028,7 +2028,7 @@ fn crate_versions_flag_is_overridden() {
20282028
};
20292029
let asserts = |html: String| {
20302030
assert!(!html.contains("1.2.4"));
2031-
assert!(html.contains("Version 2.0.3"));
2031+
assert!(html.contains("2.0.3"));
20322032
};
20332033

20342034
p.cargo("doc")

tests/testsuite/rustdocflags.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,19 @@ fn whitespace() {
110110
.with_status(101)
111111
.run();
112112

113-
const SPACED_VERSION: &str = "a\nb\tc\u{00a0}d";
114113
p.cargo("doc")
115114
.env_remove("__CARGO_TEST_FORCE_ARGFILE") // Not applicable for argfile.
116115
.env(
117116
"RUSTDOCFLAGS",
118-
format!("--crate-version {}", SPACED_VERSION),
117+
"--crate-version 1111\n2222\t3333\u{00a0}4444",
119118
)
120119
.run();
121120

122121
let contents = p.read_file("target/doc/foo/index.html");
123-
assert!(contents.contains(SPACED_VERSION));
122+
assert!(contents.contains("1111"));
123+
assert!(contents.contains("2222"));
124+
assert!(contents.contains("3333"));
125+
assert!(contents.contains("4444"));
124126
}
125127

126128
#[cargo_test]

0 commit comments

Comments
 (0)