Skip to content

Commit 25b1a6c

Browse files
committed
Add a regression test
1 parent ed20c81 commit 25b1a6c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/testsuite/test.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff 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]
44594499
fn json_artifact_includes_executable_for_integration_tests() {
44604500
let p = project()

0 commit comments

Comments
 (0)