Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc test clean up #14297

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
68 changes: 36 additions & 32 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down