File tree Expand file tree Collapse file tree
tests/run-make/rustdoc-themes Expand file tree Collapse file tree 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 = 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+ }
You can’t perform that action at this time.
0 commit comments