test: Migrate json install doc to snapbox

This commit is contained in:
Ed Page 2024-07-23 13:49:38 -05:00
parent 65577954ce
commit 3085b548ec

View File

@ -1879,24 +1879,29 @@ fn doc_message_format() {
p.cargo("doc --message-format=json") p.cargo("doc --message-format=json")
.with_status(101) .with_status(101)
.with_json_contains_unordered( .with_stdout_data(
r#" str![[r##"
{ [
"message": { {
"$message_type": "diagnostic", "manifest_path": "[ROOT]/foo/Cargo.toml",
"children": "{...}", "message": {
"code": "{...}", "$message_type": "diagnostic",
"level": "error", "children": "{...}",
"message": "{...}", "code": "{...}",
"rendered": "{...}", "level": "error",
"spans": "{...}" "message": "{...}",
}, "rendered": "{...}",
"package_id": "path+file:///[..]/foo#0.0.1", "spans": "{...}"
"manifest_path": "[..]", },
"reason": "compiler-message", "package_id": "path+[ROOTURL]/foo#0.0.1",
"target": "{...}" "reason": "compiler-message",
} "target": "{...}"
"#, },
"{...}"
]
"##]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }
@ -1911,76 +1916,95 @@ fn doc_json_artifacts() {
.build(); .build();
p.cargo("doc --message-format=json") p.cargo("doc --message-format=json")
.with_json_contains_unordered( .with_stdout_data(
r#" str![[r#"
{ [
"reason": "compiler-artifact", {
"package_id": "path+file:///[..]/foo#0.0.1",
"manifest_path": "[ROOT]/foo/Cargo.toml",
"target":
{
"kind": ["lib"],
"crate_types": ["lib"],
"name": "foo",
"src_path": "[ROOT]/foo/src/lib.rs",
"edition": "2015",
"doc": true,
"doctest": true,
"test": true
},
"profile": "{...}",
"features": [],
"filenames": ["[ROOT]/foo/target/debug/deps/libfoo-[..].rmeta"],
"executable": null, "executable": null,
"fresh": false
}
{
"reason": "compiler-artifact",
"package_id": "path+file:///[..]/foo#0.0.1",
"manifest_path": "[ROOT]/foo/Cargo.toml",
"target":
{
"kind": ["lib"],
"crate_types": ["lib"],
"name": "foo",
"src_path": "[ROOT]/foo/src/lib.rs",
"edition": "2015",
"doc": true,
"doctest": true,
"test": true
},
"profile": "{...}",
"features": [], "features": [],
"filenames": ["[ROOT]/foo/target/doc/foo/index.html"], "filenames": [
"executable": null, "[ROOT]/foo/target/debug/deps/libfoo-[HASH].rmeta"
"fresh": false ],
} "fresh": false,
{
"reason": "compiler-artifact",
"package_id": "path+file:///[..]/foo#0.0.1",
"manifest_path": "[ROOT]/foo/Cargo.toml", "manifest_path": "[ROOT]/foo/Cargo.toml",
"target": "package_id": "path+[ROOTURL]/foo#0.0.1",
{
"kind": ["bin"],
"crate_types": ["bin"],
"name": "somebin",
"src_path": "[ROOT]/foo/src/bin/somebin.rs",
"edition": "2015",
"doc": true,
"doctest": false,
"test": true
},
"profile": "{...}", "profile": "{...}",
"features": [], "reason": "compiler-artifact",
"filenames": ["[ROOT]/foo/target/doc/somebin/index.html"], "target": {
"crate_types": [
"lib"
],
"doc": true,
"doctest": true,
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[ROOT]/foo/src/lib.rs",
"test": true
}
},
{
"executable": null, "executable": null,
"fresh": false "features": [],
} "filenames": [
"[ROOT]/foo/target/doc/foo/index.html"
{"reason":"build-finished","success":true} ],
"#, "fresh": false,
"manifest_path": "[ROOT]/foo/Cargo.toml",
"package_id": "path+[ROOTURL]/foo#0.0.1",
"profile": "{...}",
"reason": "compiler-artifact",
"target": {
"crate_types": [
"lib"
],
"doc": true,
"doctest": true,
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[ROOT]/foo/src/lib.rs",
"test": true
}
},
{
"executable": null,
"features": [],
"filenames": [
"[ROOT]/foo/target/doc/somebin/index.html"
],
"fresh": false,
"manifest_path": "[ROOT]/foo/Cargo.toml",
"package_id": "path+[ROOTURL]/foo#0.0.1",
"profile": "{...}",
"reason": "compiler-artifact",
"target": {
"crate_types": [
"bin"
],
"doc": true,
"doctest": false,
"edition": "2015",
"kind": [
"bin"
],
"name": "somebin",
"src_path": "[ROOT]/foo/src/bin/somebin.rs",
"test": true
}
},
{
"reason": "build-finished",
"success": true
}
]
"#]]
.is_json()
.against_jsonlines(),
) )
.run(); .run();
} }