Skip to content

Commit 6e1f934

Browse files
committed
test: Migrate some json test tests to snapbox
1 parent b45b878 commit 6e1f934

File tree

1 file changed

+86
-50
lines changed

1 file changed

+86
-50
lines changed

tests/testsuite/test.rs

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,31 +4428,49 @@ 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]",
4436+
"features": [],
4437+
"filenames": [
4438+
"[ROOT]/foo/target/debug/deps/foo-[HASH]"
4439+
],
4440+
"fresh": false,
4441+
"manifest_path": "[ROOT]/foo/Cargo.toml",
4442+
"package_id": "path+[ROOTURL]/foo#0.0.1",
4443+
"profile": {
4444+
"debug_assertions": true,
4445+
"debuginfo": 2,
4446+
"opt_level": "0",
4447+
"overflow_checks": true,
4448+
"test": true
4449+
},
4450+
"reason": "compiler-artifact",
4451+
"target": {
4452+
"crate_types": [
4453+
"lib"
4454+
],
4455+
"doc": true,
4456+
"doctest": true,
4457+
"edition": "2015",
4458+
"kind": [
4459+
"lib"
4460+
],
4461+
"name": "foo",
4462+
"src_path": "[ROOT]/foo/src/lib.rs",
4463+
"test": true
4464+
}
4465+
},
4466+
{
4467+
"reason": "build-finished",
4468+
"success": true
4469+
}
4470+
]
4471+
"#]]
4472+
.is_json()
4473+
.against_jsonlines(),
44564474
)
44574475
.run();
44584476
}
@@ -4468,31 +4486,49 @@ fn json_artifact_includes_executable_for_integration_tests() {
44684486
.build();
44694487

44704488
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-
"#,
4489+
.with_stdout_data(
4490+
str![[r#"
4491+
[
4492+
{
4493+
"executable": "[ROOT]/foo/target/debug/deps/integration_test-[HASH]",
4494+
"features": [],
4495+
"filenames": [
4496+
"[ROOT]/foo/target/debug/deps/integration_test-[HASH]"
4497+
],
4498+
"fresh": false,
4499+
"manifest_path": "[ROOT]/foo/Cargo.toml",
4500+
"package_id": "path+[ROOTURL]/foo#0.0.1",
4501+
"profile": {
4502+
"debug_assertions": true,
4503+
"debuginfo": 2,
4504+
"opt_level": "0",
4505+
"overflow_checks": true,
4506+
"test": true
4507+
},
4508+
"reason": "compiler-artifact",
4509+
"target": {
4510+
"crate_types": [
4511+
"bin"
4512+
],
4513+
"doc": false,
4514+
"doctest": false,
4515+
"edition": "2015",
4516+
"kind": [
4517+
"test"
4518+
],
4519+
"name": "integration_test",
4520+
"src_path": "[ROOT]/foo/tests/integration_test.rs",
4521+
"test": true
4522+
}
4523+
},
4524+
{
4525+
"reason": "build-finished",
4526+
"success": true
4527+
}
4528+
]
4529+
"#]]
4530+
.is_json()
4531+
.against_jsonlines(),
44964532
)
44974533
.run();
44984534
}

0 commit comments

Comments
 (0)