This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
tests/run-make/rustdoc-output-stdout Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 44use std:: path:: PathBuf ;
55
66use 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 } ;
88
99fn main ( ) {
10- // First we check that we generate the JSON in the stdout.
11- rustdoc ( )
10+ let json_string = rustdoc ( )
1211 . input ( "foo.rs" )
1312 . out_dir ( "-" )
1413 . arg ( "-Zunstable-options" )
1514 . output_format ( "json" )
1615 . 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 ) ;
1829
1930 // Then we check it didn't generate any JSON file.
2031 read_dir_entries_recursive ( cwd ( ) , |path| {
You can’t perform that action at this time.
0 commit comments