@@ -9,16 +9,14 @@ use run_make_support::{path, rfs, rustdoc};
99fn main ( ) {
1010 rfs:: create_dir ( "doc" ) ;
1111
12- // We're only emitting dep info, so we shouldn't be running static analysis to
13- // figure out that this program is erroneous.
1412 // Ensure that all kinds of input reading flags end up in dep-info.
1513 rustdoc ( )
1614 . input ( "lib.rs" )
1715 . arg ( "-Zunstable-options" )
1816 . arg ( "--html-before-content=before.html" )
1917 . arg ( "--markdown-after-content=after.md" )
2018 . arg ( "--extend-css=extend.css" )
21- . arg ( "--theme=theme .css" )
19+ . arg ( "--theme=custom_theme .css" )
2220 . arg ( "--index-page=index-page.md" )
2321 . emit ( "dep-info" )
2422 . run ( ) ;
@@ -31,8 +29,31 @@ fn main() {
3129 assert_contains ( & content, "after.md:" ) ;
3230 assert_contains ( & content, "before.html:" ) ;
3331 assert_contains ( & content, "extend.css:" ) ;
34- assert_contains ( & content, "theme .css:" ) ;
32+ assert_contains ( & content, "custom_theme .css:" ) ;
3533 assert_contains ( & content, "index-page.md:" ) ;
34+ // Only emit dep-info. Don't emit the actual page.
35+ assert ! ( !path( "doc/foo/index.html" ) . exists( ) ) ;
36+ assert ! ( !path( "doc/custom_theme.css" ) . exists( ) ) ;
37+ // weird that --extend-css generates a file named theme.css
38+ assert ! ( !path( "doc/theme.css" ) . exists( ) ) ;
39+
40+ // Now try emitting dep-info and html files at the same time.
41+ rustdoc ( )
42+ . input ( "lib.rs" )
43+ . arg ( "-Zunstable-options" )
44+ . arg ( "--html-before-content=before.html" )
45+ . arg ( "--markdown-after-content=after.md" )
46+ . arg ( "--extend-css=extend.css" )
47+ . arg ( "--theme=custom_theme.css" )
48+ . arg ( "--index-page=index-page.md" )
49+ . emit ( "dep-info,html-non-static-files,html-static-files" )
50+ . run ( ) ;
51+ assert ! ( path( "doc/foo/index.html" ) . exists( ) ) ;
52+ // These files are copied into the doc output folder,
53+ // which is why they show up in dep-info.
54+ assert ! ( path( "doc/custom_theme.css" ) . exists( ) ) ;
55+ // weird that --extend-css generates a file named theme.css
56+ assert ! ( path( "doc/theme.css" ) . exists( ) ) ;
3657
3758 // Now we check that we can provide a file name to the `dep-info` argument.
3859 rustdoc ( ) . input ( "lib.rs" ) . arg ( "-Zunstable-options" ) . emit ( "dep-info=bla.d" ) . run ( ) ;
@@ -72,7 +93,9 @@ fn main() {
7293 assert_not_contains ( & content, "after.md:" ) ;
7394 assert_not_contains ( & content, "before.html:" ) ;
7495 assert_not_contains ( & content, "extend.css:" ) ;
75- assert_not_contains ( & content, "theme.css:" ) ;
96+ assert_not_contains ( & content, "custom_theme.css:" ) ;
97+ // Only emit dep-info, not the actual html.
98+ assert ! ( !path( "doc/example.html" ) . exists( ) ) ;
7699
77100 // combine --emit=dep-info=filename with plain markdown input
78101 rustdoc ( )
@@ -81,10 +104,12 @@ fn main() {
81104 . arg ( "--html-before-content=before.html" )
82105 . arg ( "--markdown-after-content=after.md" )
83106 . arg ( "--extend-css=extend.css" )
84- . arg ( "--theme=theme.css" )
107+ . arg ( "--theme=custom_theme.css" )
108+ . arg ( "--markdown-css=markdown.css" )
85109 . arg ( "--index-page=index-page.md" )
86- . emit ( "dep-info=example.d" )
110+ . emit ( "dep-info=example.d,html-non-static-files,html-static-files " )
87111 . run ( ) ;
112+ assert ! ( path( "doc/example.html" ) . exists( ) ) ;
88113 let content = rfs:: read_to_string ( "example.d" ) ;
89114 assert_contains ( & content, "example.md:" ) ;
90115 assert_not_contains ( & content, "lib.rs:" ) ;
@@ -93,7 +118,17 @@ fn main() {
93118 assert_not_contains ( & content, "doc.md:" ) ;
94119 assert_contains ( & content, "after.md:" ) ;
95120 assert_contains ( & content, "before.html:" ) ;
96- assert_contains ( & content, "extend.css:" ) ;
97- assert_contains ( & content, "theme.css:" ) ;
98121 assert_contains ( & content, "index-page.md:" ) ;
122+ // This is a hotlink, not a file that gets copied,
123+ // so it shouldn't add to the dep-info, it shouldn't be copied,
124+ // and it shouldn't be resolved relative to the root path.
125+ //
126+ // It's weird that this is different from the other two css
127+ // files, but it's stable, so I can't change it.
128+ assert ! ( !path( "doc/markdown.css" ) . exists( ) ) ;
129+ assert_not_contains ( & content, "markdown.css:" ) ;
130+ // These files aren't actually used, and the fact that they show up
131+ // is arguably a bug, but test it anyway.
132+ assert_contains ( & content, "extend.css:" ) ;
133+ assert_contains ( & content, "custom_theme.css:" ) ;
99134}
0 commit comments