Skip to content

Commit ee2d6cc

Browse files
committed
test: Migrate json pkgid tests to snapbox
1 parent 16448d4 commit ee2d6cc

File tree

1 file changed

+40
-59
lines changed

1 file changed

+40
-59
lines changed

tests/testsuite/pkgid.rs

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -306,66 +306,47 @@ fn pkgid_json_message_metadata_consistency() {
306306
let pkgid = pkgid.trim();
307307
assert_e2e().eq(pkgid, str!["path+[ROOTURL]/foo#0.5.0"]);
308308

309-
#[allow(deprecated)]
310309
p.cargo("check --message-format=json")
311-
.with_json(
312-
&r#"
313-
{
314-
"reason": "compiler-artifact",
315-
"package_id": "$PKGID",
316-
"manifest_path": "[..]",
317-
"target": "{...}",
318-
"profile": "{...}",
319-
"features": [],
320-
"filenames": "{...}",
321-
"executable": null,
322-
"fresh": false
323-
}
324-
325-
{
326-
"reason": "build-script-executed",
327-
"package_id": "$PKGID",
328-
"linked_libs": [],
329-
"linked_paths": [],
330-
"cfgs": [],
331-
"env": [],
332-
"out_dir": "[..]"
333-
}
334-
335-
{
336-
"manifest_path": "[..]",
337-
"message": "{...}",
338-
"package_id": "$PKGID",
339-
"reason": "compiler-message",
340-
"target": "{...}"
341-
}
342-
343-
{
344-
"reason": "compiler-message",
345-
"package_id": "$PKGID",
346-
"manifest_path": "[..]",
347-
"target": "{...}",
348-
"message": "{...}"
349-
}
350-
351-
{
352-
"reason": "compiler-artifact",
353-
"package_id": "$PKGID",
354-
"manifest_path": "[..]",
355-
"target": "{...}",
356-
"profile": "{...}",
357-
"features": [],
358-
"filenames": "{...}",
359-
"executable": null,
360-
"fresh": false
361-
}
362-
363-
{
364-
"reason": "build-finished",
365-
"success": true
366-
}
367-
"#
368-
.replace("$PKGID", pkgid),
310+
.with_stdout_data(
311+
str![[r#"
312+
[
313+
{
314+
"manifest_path": "[ROOT]/foo/Cargo.toml",
315+
"package_id": "path+[ROOTURL]/foo#0.5.0",
316+
"reason": "compiler-artifact",
317+
"...": "{...}"
318+
},
319+
{
320+
"package_id": "path+[ROOTURL]/foo#0.5.0",
321+
"reason": "build-script-executed",
322+
"...": "{...}"
323+
},
324+
{
325+
"manifest_path": "[ROOT]/foo/Cargo.toml",
326+
"package_id": "path+[ROOTURL]/foo#0.5.0",
327+
"reason": "compiler-message",
328+
"...": "{...}"
329+
},
330+
{
331+
"manifest_path": "[ROOT]/foo/Cargo.toml",
332+
"package_id": "path+[ROOTURL]/foo#0.5.0",
333+
"reason": "compiler-message",
334+
"...": "{...}"
335+
},
336+
{
337+
"manifest_path": "[ROOT]/foo/Cargo.toml",
338+
"package_id": "path+[ROOTURL]/foo#0.5.0",
339+
"reason": "compiler-artifact",
340+
"...": "{...}"
341+
},
342+
{
343+
"reason": "build-finished",
344+
"success": true
345+
}
346+
]
347+
"#]]
348+
.is_json()
349+
.against_jsonlines(),
369350
)
370351
.run();
371352

0 commit comments

Comments
 (0)