File tree 1 file changed +15
-4
lines changed
tests/run-make/rustdoc-output-stdout
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 4
4
use std:: path:: PathBuf ;
5
5
6
6
use run_make_support:: path_helpers:: { cwd, has_extension, read_dir_entries_recursive} ;
7
- use run_make_support:: rustdoc;
7
+ use run_make_support:: { rustdoc, serde_json } ;
8
8
9
9
fn main ( ) {
10
- // First we check that we generate the JSON in the stdout.
11
- rustdoc ( )
10
+ let json_string = rustdoc ( )
12
11
. input ( "foo.rs" )
13
12
. out_dir ( "-" )
14
13
. arg ( "-Zunstable-options" )
15
14
. output_format ( "json" )
16
15
. run ( )
17
- . assert_stdout_contains ( "{\" " ) ;
16
+ . stdout_utf8 ( ) ;
17
+
18
+ // First we check that we generate the JSON in the stdout.
19
+ let json_value: serde_json:: Value =
20
+ serde_json:: from_str ( & json_string) . expect ( "stdout should be valid json" ) ;
21
+
22
+ // We don't care to test the specifics of the JSON, as that's done
23
+ // elsewhere, just check that it has a format_version (as all JSON output
24
+ // should).
25
+ let format_version = json_value[ "format_version" ]
26
+ . as_i64 ( )
27
+ . expect ( "json output should contain format_version field" ) ;
28
+ assert ! ( format_version > 30 ) ;
18
29
19
30
// Then we check it didn't generate any JSON file.
20
31
read_dir_entries_recursive ( cwd ( ) , |path| {
You can’t perform that action at this time.
0 commit comments