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,15 +741,17 @@ 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, "executable": null,
"features": [], "features": [],
"filenames": "{...}", "filenames": "{...}",
"fresh": false, "fresh": false,
"package_id": "path+file:///[..]/foo#0.0.1", "manifest_path": "[ROOT]/foo/Cargo.toml",
"manifest_path": "[..]", "package_id": "path+[ROOTURL]/foo#0.0.1",
"profile": "{...}", "profile": "{...}",
"reason": "compiler-artifact", "reason": "compiler-artifact",
"target": { "target": {
@ -763,21 +765,24 @@ fn metabuild_json_artifact() {
"custom-build" "custom-build"
], ],
"name": "metabuild-foo", "name": "metabuild-foo",
"src_path": "[..]/foo/target/.metabuild/metabuild-foo-[..].rs", "src_path": "[ROOT]/foo/target/.metabuild/metabuild-foo-[HASH].rs",
"test": false "test": false
} }
} },
{ {
"cfgs": [], "cfgs": [],
"env": [], "env": [],
"linked_libs": [], "linked_libs": [],
"linked_paths": [], "linked_paths": [],
"package_id": "path+file:///[..]/foo#0.0.1", "out_dir": "[ROOT]/foo/target/debug/build/foo-[HASH]/out",
"out_dir": "[..]", "package_id": "path+[ROOTURL]/foo#0.0.1",
"reason": "build-script-executed" "reason": "build-script-executed"
} },
"#, "{...}"
]
"#]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }
@ -791,20 +796,18 @@ 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#"
[
"{...}",
{ {
"manifest_path": "[ROOT]/foo/Cargo.toml",
"message": { "message": {
"$message_type": "diagnostic",
"children": "{...}",
"code": "{...}",
"level": "error", "level": "error",
"message": "cannot find function `metabuild`[..]", "message": "cannot find function `metabuild` in crate `mb`",
"rendered": "{...}", "...": "{...}"
"spans": "{...}"
}, },
"package_id": "path+file:///[..]/foo#0.0.1", "package_id": "path+[ROOTURL]/foo#0.0.1",
"manifest_path": "[..]",
"reason": "compiler-message", "reason": "compiler-message",
"target": { "target": {
"crate_types": [ "crate_types": [
@ -820,8 +823,12 @@ fn metabuild_failed_build_json() {
"src_path": null, "src_path": null,
"test": false "test": false
} }
} },
"#, "{...}"
]
"#]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }