File tree Expand file tree Collapse file tree 2 files changed +31
-11
lines changed
tests/run-make/rustdoc-themes Expand file tree Collapse file tree 2 files changed +31
-11
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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 =
10+ std:: fs:: read_to_string ( source_path ( ) . join ( "src/librustdoc/html/static/css/noscript.css" ) )
11+ . unwrap ( ) ;
12+
13+ let mut test_content = String :: new ( ) ;
14+ let mut found_begin_light = false ;
15+ for line in no_script. split ( '\n' ) {
16+ if line == "/* Begin theme: light */" {
17+ found_begin_light = true ;
18+ } else if line == "/* End theme: light */" {
19+ break ;
20+ } else if found_begin_light {
21+ test_content. push_str ( line) ;
22+ test_content. push ( '\n' ) ;
23+ }
24+ }
25+ assert ! ( !test_content. is_empty( ) ) ;
26+ std:: fs:: create_dir_all ( & out_dir) . unwrap ( ) ;
27+ std:: fs:: write ( & test_css, test_content) . unwrap ( ) ;
28+
29+ rustdoc ( ) . output ( & out_dir) . input ( "foo.rs" ) . arg ( "--theme" ) . arg ( & test_css) . run ( ) ;
30+ htmldocck ( ) . arg ( out_dir) . arg ( "foo.rs" ) . status ( ) . unwrap ( ) . success ( ) ;
31+ }
You can’t perform that action at this time.
0 commit comments