Skip to content

Commit a58b231

Browse files
committed
test: migrate metabuild json to snapbox
1 parent f4937a9 commit a58b231

File tree

1 file changed

+75
-68
lines changed

1 file changed

+75
-68
lines changed

tests/testsuite/metabuild.rs

Lines changed: 75 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -741,43 +741,48 @@ fn metabuild_json_artifact() {
741741
let p = basic_project();
742742
p.cargo("check --message-format=json")
743743
.masquerade_as_nightly_cargo(&["metabuild"])
744-
.with_json_contains_unordered(
745-
r#"
746-
{
747-
"executable": null,
748-
"features": [],
749-
"filenames": "{...}",
750-
"fresh": false,
751-
"package_id": "path+file:///[..]/foo#0.0.1",
752-
"manifest_path": "[..]",
753-
"profile": "{...}",
754-
"reason": "compiler-artifact",
755-
"target": {
756-
"crate_types": [
757-
"bin"
758-
],
759-
"doc": false,
760-
"doctest": false,
761-
"edition": "2018",
762-
"kind": [
763-
"custom-build"
764-
],
765-
"name": "metabuild-foo",
766-
"src_path": "[..]/foo/target/.metabuild/metabuild-foo-[..].rs",
767-
"test": false
768-
}
769-
}
770-
771-
{
772-
"cfgs": [],
773-
"env": [],
774-
"linked_libs": [],
775-
"linked_paths": [],
776-
"package_id": "path+file:///[..]/foo#0.0.1",
777-
"out_dir": "[..]",
778-
"reason": "build-script-executed"
779-
}
780-
"#,
744+
.with_stdout_data(
745+
str![[r#"
746+
[
747+
"{...}",
748+
{
749+
"executable": null,
750+
"features": [],
751+
"filenames": "{...}",
752+
"fresh": false,
753+
"manifest_path": "[ROOT]/foo/Cargo.toml",
754+
"package_id": "path+[ROOTURL]/foo#0.0.1",
755+
"profile": "{...}",
756+
"reason": "compiler-artifact",
757+
"target": {
758+
"crate_types": [
759+
"bin"
760+
],
761+
"doc": false,
762+
"doctest": false,
763+
"edition": "2018",
764+
"kind": [
765+
"custom-build"
766+
],
767+
"name": "metabuild-foo",
768+
"src_path": "[ROOT]/foo/target/.metabuild/metabuild-foo-[HASH].rs",
769+
"test": false
770+
}
771+
},
772+
{
773+
"cfgs": [],
774+
"env": [],
775+
"linked_libs": [],
776+
"linked_paths": [],
777+
"out_dir": "[ROOT]/foo/target/debug/build/foo-[HASH]/out",
778+
"package_id": "path+[ROOTURL]/foo#0.0.1",
779+
"reason": "build-script-executed"
780+
},
781+
"{...}"
782+
]
783+
"#]]
784+
.is_json()
785+
.against_jsonlines(),
781786
)
782787
.run();
783788
}
@@ -791,37 +796,39 @@ fn metabuild_failed_build_json() {
791796
p.cargo("check --message-format=json")
792797
.masquerade_as_nightly_cargo(&["metabuild"])
793798
.with_status(101)
794-
.with_json_contains_unordered(
795-
r#"
796-
{
797-
"message": {
798-
"$message_type": "diagnostic",
799-
"children": "{...}",
800-
"code": "{...}",
801-
"level": "error",
802-
"message": "cannot find function `metabuild`[..]",
803-
"rendered": "{...}",
804-
"spans": "{...}"
805-
},
806-
"package_id": "path+file:///[..]/foo#0.0.1",
807-
"manifest_path": "[..]",
808-
"reason": "compiler-message",
809-
"target": {
810-
"crate_types": [
811-
"bin"
812-
],
813-
"doc": false,
814-
"doctest": false,
815-
"edition": "2018",
816-
"kind": [
817-
"custom-build"
818-
],
819-
"name": "metabuild-foo",
820-
"src_path": null,
821-
"test": false
822-
}
823-
}
824-
"#,
799+
.with_stdout_data(
800+
str![[r#"
801+
[
802+
"{...}",
803+
{
804+
"manifest_path": "[ROOT]/foo/Cargo.toml",
805+
"message": {
806+
"level": "error",
807+
"message": "cannot find function `metabuild` in crate `mb`",
808+
"...": "{...}"
809+
},
810+
"package_id": "path+[ROOTURL]/foo#0.0.1",
811+
"reason": "compiler-message",
812+
"target": {
813+
"crate_types": [
814+
"bin"
815+
],
816+
"doc": false,
817+
"doctest": false,
818+
"edition": "2018",
819+
"kind": [
820+
"custom-build"
821+
],
822+
"name": "metabuild-foo",
823+
"src_path": null,
824+
"test": false
825+
}
826+
},
827+
"{...}"
828+
]
829+
"#]]
830+
.is_json()
831+
.against_jsonlines(),
825832
)
826833
.run();
827834
}

0 commit comments

Comments
 (0)