Skip to content

Commit cbb3222

Browse files
committed
test: Migrate some json test tests to snapbox
1 parent ee2d6cc commit cbb3222

File tree

1 file changed

+70
-50
lines changed

1 file changed

+70
-50
lines changed

tests/testsuite/test.rs

Lines changed: 70 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,31 +4428,41 @@ fn json_artifact_includes_executable_for_library_tests() {
44284428
.build();
44294429

44304430
p.cargo("test --lib -v --no-run --message-format=json")
4431-
.with_json(
4432-
r#"
4433-
{
4434-
"executable": "[..]/foo/target/debug/deps/foo-[..][EXE]",
4435-
"features": [],
4436-
"filenames": "{...}",
4437-
"fresh": false,
4438-
"package_id": "path+file:///[..]/foo#0.0.1",
4439-
"manifest_path": "[..]",
4440-
"profile": "{...}",
4441-
"reason": "compiler-artifact",
4442-
"target": {
4443-
"crate_types": [ "lib" ],
4444-
"kind": [ "lib" ],
4445-
"doc": true,
4446-
"doctest": true,
4447-
"edition": "2015",
4448-
"name": "foo",
4449-
"src_path": "[..]/foo/src/lib.rs",
4450-
"test": true
4451-
}
4452-
}
4453-
4454-
{"reason": "build-finished", "success": true}
4455-
"#,
4431+
.with_stdout_data(
4432+
str![[r#"
4433+
[
4434+
{
4435+
"executable": "[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]",
4436+
"features": [],
4437+
"filenames": "{...}",
4438+
"fresh": false,
4439+
"manifest_path": "[ROOT]/foo/Cargo.toml",
4440+
"package_id": "path+[ROOTURL]/foo#0.0.1",
4441+
"profile": "{...}",
4442+
"reason": "compiler-artifact",
4443+
"target": {
4444+
"crate_types": [
4445+
"lib"
4446+
],
4447+
"doc": true,
4448+
"doctest": true,
4449+
"edition": "2015",
4450+
"kind": [
4451+
"lib"
4452+
],
4453+
"name": "foo",
4454+
"src_path": "[ROOT]/foo/src/lib.rs",
4455+
"test": true
4456+
}
4457+
},
4458+
{
4459+
"reason": "build-finished",
4460+
"success": true
4461+
}
4462+
]
4463+
"#]]
4464+
.is_json()
4465+
.against_jsonlines(),
44564466
)
44574467
.run();
44584468
}
@@ -4468,31 +4478,41 @@ fn json_artifact_includes_executable_for_integration_tests() {
44684478
.build();
44694479

44704480
p.cargo("test -v --no-run --message-format=json --test integration_test")
4471-
.with_json(
4472-
r#"
4473-
{
4474-
"executable": "[..]/foo/target/debug/deps/integration_test-[..][EXE]",
4475-
"features": [],
4476-
"filenames": "{...}",
4477-
"fresh": false,
4478-
"package_id": "path+file:///[..]/foo#0.0.1",
4479-
"manifest_path": "[..]",
4480-
"profile": "{...}",
4481-
"reason": "compiler-artifact",
4482-
"target": {
4483-
"crate_types": [ "bin" ],
4484-
"kind": [ "test" ],
4485-
"doc": false,
4486-
"doctest": false,
4487-
"edition": "2015",
4488-
"name": "integration_test",
4489-
"src_path": "[..]/foo/tests/integration_test.rs",
4490-
"test": true
4491-
}
4492-
}
4493-
4494-
{"reason": "build-finished", "success": true}
4495-
"#,
4481+
.with_stdout_data(
4482+
str![[r#"
4483+
[
4484+
{
4485+
"executable": "[ROOT]/foo/target/debug/deps/integration_test-[HASH][EXE]",
4486+
"features": [],
4487+
"filenames": "{...}",
4488+
"fresh": false,
4489+
"manifest_path": "[ROOT]/foo/Cargo.toml",
4490+
"package_id": "path+[ROOTURL]/foo#0.0.1",
4491+
"profile": "{...}",
4492+
"reason": "compiler-artifact",
4493+
"target": {
4494+
"crate_types": [
4495+
"bin"
4496+
],
4497+
"doc": false,
4498+
"doctest": false,
4499+
"edition": "2015",
4500+
"kind": [
4501+
"test"
4502+
],
4503+
"name": "integration_test",
4504+
"src_path": "[ROOT]/foo/tests/integration_test.rs",
4505+
"test": true
4506+
}
4507+
},
4508+
{
4509+
"reason": "build-finished",
4510+
"success": true
4511+
}
4512+
]
4513+
"#]]
4514+
.is_json()
4515+
.against_jsonlines(),
44964516
)
44974517
.run();
44984518
}

0 commit comments

Comments
 (0)