Skip to content

Commit fb48bc7

Browse files
Migrate run-make/rustdoc-themes to new rmake
1 parent c87ae94 commit fb48bc7

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

tests/run-make/rustdoc-themes/Makefile

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Test that rustdoc will properly load in a theme file and display it in the theme selector.
2+
3+
use run_make_support::{htmldocck, rustdoc, source_path, tmp_dir};
4+
5+
fn main() {
6+
let out_dir = tmp_dir().join("rustdoc-themes");
7+
let test_css = out_dir.join("test.css");
8+
9+
let no_script = std::fs::read_to_string(source_path().join("src/librustdoc/html/static/css/noscript.css")).unwrap();
10+
11+
let mut test_content = String::new();
12+
let mut found_begin_light = false;
13+
for line in no_script.split('\n') {
14+
if line == "/* Begin theme: light */" {
15+
found_begin_light = true;
16+
} else if line == "/* End theme: light */" {
17+
break;
18+
} else if found_begin_light {
19+
test_content.push_str(line);
20+
test_content.push('\n');
21+
}
22+
}
23+
assert!(!test_content.is_empty());
24+
std::fs::create_dir_all(&out_dir).unwrap();
25+
std::fs::write(&test_css, test_content).unwrap();
26+
27+
rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
28+
htmldocck().arg(out_dir).arg("foo.rs").status()
29+
.unwrap()
30+
.success();
31+
}

0 commit comments

Comments
 (0)