test: migrate metabuild json to snapbox

This commit is contained in:
Ed Page 2024-08-14 16:03:02 -05:00
parent f4937a9b58
commit a58b2318d3

View File

@ -741,43 +741,48 @@ fn metabuild_json_artifact() {
let p = basic_project(); let p = basic_project();
p.cargo("check --message-format=json") p.cargo("check --message-format=json")
.masquerade_as_nightly_cargo(&["metabuild"]) .masquerade_as_nightly_cargo(&["metabuild"])
.with_json_contains_unordered( .with_stdout_data(
r#" str![[r#"
{ [
"executable": null, "{...}",
"features": [], {
"filenames": "{...}", "executable": null,
"fresh": false, "features": [],
"package_id": "path+file:///[..]/foo#0.0.1", "filenames": "{...}",
"manifest_path": "[..]", "fresh": false,
"profile": "{...}", "manifest_path": "[ROOT]/foo/Cargo.toml",
"reason": "compiler-artifact", "package_id": "path+[ROOTURL]/foo#0.0.1",
"target": { "profile": "{...}",
"crate_types": [ "reason": "compiler-artifact",
"bin" "target": {
], "crate_types": [
"doc": false, "bin"
"doctest": false, ],
"edition": "2018", "doc": false,
"kind": [ "doctest": false,
"custom-build" "edition": "2018",
], "kind": [
"name": "metabuild-foo", "custom-build"
"src_path": "[..]/foo/target/.metabuild/metabuild-foo-[..].rs", ],
"test": false "name": "metabuild-foo",
} "src_path": "[ROOT]/foo/target/.metabuild/metabuild-foo-[HASH].rs",
} "test": false
}
{ },
"cfgs": [], {
"env": [], "cfgs": [],
"linked_libs": [], "env": [],
"linked_paths": [], "linked_libs": [],
"package_id": "path+file:///[..]/foo#0.0.1", "linked_paths": [],
"out_dir": "[..]", "out_dir": "[ROOT]/foo/target/debug/build/foo-[HASH]/out",
"reason": "build-script-executed" "package_id": "path+[ROOTURL]/foo#0.0.1",
} "reason": "build-script-executed"
"#, },
"{...}"
]
"#]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }
@ -791,37 +796,39 @@ fn metabuild_failed_build_json() {
p.cargo("check --message-format=json") p.cargo("check --message-format=json")
.masquerade_as_nightly_cargo(&["metabuild"]) .masquerade_as_nightly_cargo(&["metabuild"])
.with_status(101) .with_status(101)
.with_json_contains_unordered( .with_stdout_data(
r#" str![[r#"
{ [
"message": { "{...}",
"$message_type": "diagnostic", {
"children": "{...}", "manifest_path": "[ROOT]/foo/Cargo.toml",
"code": "{...}", "message": {
"level": "error", "level": "error",
"message": "cannot find function `metabuild`[..]", "message": "cannot find function `metabuild` in crate `mb`",
"rendered": "{...}", "...": "{...}"
"spans": "{...}" },
}, "package_id": "path+[ROOTURL]/foo#0.0.1",
"package_id": "path+file:///[..]/foo#0.0.1", "reason": "compiler-message",
"manifest_path": "[..]", "target": {
"reason": "compiler-message", "crate_types": [
"target": { "bin"
"crate_types": [ ],
"bin" "doc": false,
], "doctest": false,
"doc": false, "edition": "2018",
"doctest": false, "kind": [
"edition": "2018", "custom-build"
"kind": [ ],
"custom-build" "name": "metabuild-foo",
], "src_path": null,
"name": "metabuild-foo", "test": false
"src_path": null, }
"test": false },
} "{...}"
} ]
"#, "#]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }