File tree 2 files changed +26
-0
lines changed
tests/run-make/rustdoc-output-stdout
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub struct Foo ;
Original file line number Diff line number Diff line change
1
+ // This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
2
+ // a JSON file.
3
+
4
+ use std:: path:: PathBuf ;
5
+
6
+ use run_make_support:: path_helpers:: { cwd, has_extension, read_dir_entries_recursive} ;
7
+ use run_make_support:: rustdoc;
8
+
9
+ fn main ( ) {
10
+ // First we check that we generate the JSON in the stdout.
11
+ rustdoc ( )
12
+ . input ( "foo.rs" )
13
+ . output ( "-" )
14
+ . arg ( "-Zunstable-options" )
15
+ . output_format ( "json" )
16
+ . run ( )
17
+ . assert_stdout_contains ( "{\" " ) ;
18
+
19
+ // Then we check it didn't generate any JSON file.
20
+ read_dir_entries_recursive ( cwd ( ) , |path| {
21
+ if path. is_file ( ) && has_extension ( path, "json" ) {
22
+ panic ! ( "Found a JSON file {path:?}" ) ;
23
+ }
24
+ } ) ;
25
+ }
You can’t perform that action at this time.
0 commit comments