Skip to content

Commit 0d0bab6

Browse files
committed
Auto merge of #14297 - epage:test-json, r=weihanglo
Misc test clean up ### What does this PR try to resolve? Part of this is a follow up to #14293. Part of this is a follow up to some of #14039's work. ### How should we test and review this PR? ### Additional information
2 parents a7917fd + 922cfe5 commit 0d0bab6

File tree

2 files changed

+36
-43
lines changed

2 files changed

+36
-43
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -747,17 +747,6 @@ impl Execs {
747747
self
748748
}
749749

750-
/// Verifies that stdout contains the given contiguous lines somewhere in
751-
/// its output, and should be repeated `number` times.
752-
///
753-
/// See [`compare`] for supported patterns.
754-
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
755-
pub fn with_stdout_contains_n<S: ToString>(&mut self, expected: S, number: usize) -> &mut Self {
756-
self.expect_stdout_contains_n
757-
.push((expected.to_string(), number));
758-
self
759-
}
760-
761750
/// Verifies that stdout does not contain the given contiguous lines.
762751
///
763752
/// See [`compare`] for supported patterns.

tests/testsuite/test.rs

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4383,38 +4383,42 @@ fn json_artifact_includes_test_flag() {
43834383
.file("src/lib.rs", "")
43844384
.build();
43854385

4386-
p.cargo("test --lib -v --message-format=json")
4387-
.with_json(
4388-
r#"
4389-
{
4390-
"reason":"compiler-artifact",
4391-
"profile": {
4392-
"debug_assertions": true,
4393-
"debuginfo": 2,
4394-
"opt_level": "1",
4395-
"overflow_checks": true,
4396-
"test": true
4397-
},
4398-
"executable": "[..]/foo-[..]",
4399-
"features": [],
4400-
"package_id":"path+file:///[..]/foo#0.0.1",
4401-
"manifest_path": "[..]",
4402-
"target":{
4403-
"kind":["lib"],
4404-
"crate_types":["lib"],
4405-
"doc": true,
4406-
"doctest": true,
4407-
"edition": "2015",
4408-
"name":"foo",
4409-
"src_path":"[..]lib.rs",
4410-
"test": true
4411-
},
4412-
"filenames":"{...}",
4413-
"fresh": false
4414-
}
4415-
4416-
{"reason": "build-finished", "success": true}
4417-
"#,
4386+
p.cargo("test --lib -v --no-run --message-format=json")
4387+
.with_stdout_data(
4388+
str![[r#"
4389+
[
4390+
{
4391+
"executable": "[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]",
4392+
"features": [],
4393+
"filenames": "{...}",
4394+
"fresh": false,
4395+
"manifest_path": "[ROOT]/foo/Cargo.toml",
4396+
"package_id": "path+[ROOTURL]/foo#0.0.1",
4397+
"profile": "{...}",
4398+
"reason": "compiler-artifact",
4399+
"target": {
4400+
"crate_types": [
4401+
"lib"
4402+
],
4403+
"doc": true,
4404+
"doctest": true,
4405+
"edition": "2015",
4406+
"kind": [
4407+
"lib"
4408+
],
4409+
"name": "foo",
4410+
"src_path": "[ROOT]/foo/src/lib.rs",
4411+
"test": true
4412+
}
4413+
},
4414+
{
4415+
"reason": "build-finished",
4416+
"success": true
4417+
}
4418+
]
4419+
"#]]
4420+
.is_json()
4421+
.against_jsonlines(),
44184422
)
44194423
.run();
44204424
}

0 commit comments

Comments
 (0)