mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
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
This commit is contained in:
commit
0d0bab6d9f
@ -747,17 +747,6 @@ impl Execs {
|
||||
self
|
||||
}
|
||||
|
||||
/// Verifies that stdout contains the given contiguous lines somewhere in
|
||||
/// its output, and should be repeated `number` times.
|
||||
///
|
||||
/// See [`compare`] for supported patterns.
|
||||
#[deprecated(note = "replaced with `Execs::with_stdout_data(expected)`")]
|
||||
pub fn with_stdout_contains_n<S: ToString>(&mut self, expected: S, number: usize) -> &mut Self {
|
||||
self.expect_stdout_contains_n
|
||||
.push((expected.to_string(), number));
|
||||
self
|
||||
}
|
||||
|
||||
/// Verifies that stdout does not contain the given contiguous lines.
|
||||
///
|
||||
/// See [`compare`] for supported patterns.
|
||||
|
@ -4383,38 +4383,42 @@ fn json_artifact_includes_test_flag() {
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
p.cargo("test --lib -v --message-format=json")
|
||||
.with_json(
|
||||
r#"
|
||||
{
|
||||
"reason":"compiler-artifact",
|
||||
"profile": {
|
||||
"debug_assertions": true,
|
||||
"debuginfo": 2,
|
||||
"opt_level": "1",
|
||||
"overflow_checks": true,
|
||||
"test": true
|
||||
},
|
||||
"executable": "[..]/foo-[..]",
|
||||
"features": [],
|
||||
"package_id":"path+file:///[..]/foo#0.0.1",
|
||||
"manifest_path": "[..]",
|
||||
"target":{
|
||||
"kind":["lib"],
|
||||
"crate_types":["lib"],
|
||||
"doc": true,
|
||||
"doctest": true,
|
||||
"edition": "2015",
|
||||
"name":"foo",
|
||||
"src_path":"[..]lib.rs",
|
||||
"test": true
|
||||
},
|
||||
"filenames":"{...}",
|
||||
"fresh": false
|
||||
}
|
||||
|
||||
{"reason": "build-finished", "success": true}
|
||||
"#,
|
||||
p.cargo("test --lib -v --no-run --message-format=json")
|
||||
.with_stdout_data(
|
||||
str![[r#"
|
||||
[
|
||||
{
|
||||
"executable": "[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]",
|
||||
"features": [],
|
||||
"filenames": "{...}",
|
||||
"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
|
||||
}
|
||||
},
|
||||
{
|
||||
"reason": "build-finished",
|
||||
"success": true
|
||||
}
|
||||
]
|
||||
"#]]
|
||||
.is_json()
|
||||
.against_jsonlines(),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user