File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -4455,6 +4455,46 @@ fn json_artifact_includes_executable_for_library_tests() {
44554455 . run ( ) ;
44564456}
44574457
4458+ #[ cargo_test]
4459+ fn json_diagnostic_includes_explanation ( ) {
4460+ let p = project ( )
4461+ . file (
4462+ "src/main.rs" ,
4463+ "fn main() { const OH_NO: &'static mut usize = &mut 1; }" ,
4464+ )
4465+ . build ( ) ;
4466+
4467+ p. cargo ( "check --message-format=json" )
4468+ . with_stdout_data (
4469+ str![ [ r#"
4470+ [
4471+ {
4472+ "manifest_path": "[ROOT]/foo/Cargo.toml",
4473+ "message": {
4474+ "$message_type": "diagnostic",
4475+ "children": "{...}",
4476+ "code": {
4477+ "code": "E0764"
4478+ },
4479+ "level": "error",
4480+ "message": "{...}",
4481+ "rendered": "{...}",
4482+ "spans": "{...}"
4483+ },
4484+ "package_id": "{...}",
4485+ "reason": "compiler-message",
4486+ "target": "{...}"
4487+ },
4488+ "{...}"
4489+ ]
4490+ "# ] ]
4491+ . is_json ( )
4492+ . against_jsonlines ( ) ,
4493+ )
4494+ . with_status ( 101 )
4495+ . run ( ) ;
4496+ }
4497+
44584498#[ cargo_test]
44594499fn json_artifact_includes_executable_for_integration_tests ( ) {
44604500 let p = project ( )
You can’t perform that action at this time.
0 commit comments