Skip to content

Commit

Permalink
Auto merge of #13465 - epage:delete, r=weihanglo
Browse files Browse the repository at this point in the history
test: Remove empty snapshots

Inspired by #13461
  • Loading branch information
bors committed Feb 20, 2024
2 parents 762c7d8 + ac453f1 commit 64ccff2
Show file tree
Hide file tree
Showing 524 changed files with 527 additions and 267 deletions.
8 changes: 4 additions & 4 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use std::fs;
use std::os;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::str;
use std::sync::OnceLock;
use std::thread::JoinHandle;
use std::time::{self, Duration};
Expand All @@ -36,6 +35,7 @@ macro_rules! t {

pub use snapbox::file;
pub use snapbox::path::current_dir;
pub use snapbox::str;

#[track_caller]
pub fn panic_error(what: &str, err: impl Into<anyhow::Error>) -> ! {
Expand Down Expand Up @@ -972,8 +972,8 @@ impl Execs {

fn match_output(&self, code: Option<i32>, stdout: &[u8], stderr: &[u8]) -> Result<()> {
self.verify_checks_output(stdout, stderr);
let stdout = str::from_utf8(stdout).expect("stdout is not utf8");
let stderr = str::from_utf8(stderr).expect("stderr is not utf8");
let stdout = std::str::from_utf8(stdout).expect("stdout is not utf8");
let stderr = std::str::from_utf8(stderr).expect("stderr is not utf8");
let cwd = self.get_cwd();

match self.expect_exit_code {
Expand Down Expand Up @@ -1211,7 +1211,7 @@ pub trait TestEnv: Sized {
.exec_with_output()
{
Ok(output) => {
let s = str::from_utf8(&output.stdout).expect("utf8").trim();
let s = std::str::from_utf8(&output.stdout).expect("utf8").trim();
let mut p = PathBuf::from(s);
p.pop();
p
Expand Down
3 changes: 2 additions & 1 deletion tests/testsuite/cargo/help/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;

#[cargo_test]
fn case() {
Expand All @@ -8,5 +9,5 @@ fn case() {
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stderr_matches(file!["stderr.log"]);
.stderr_matches(str![""]);
}
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo/z_help/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;

#[cargo_test]
fn case() {
Expand All @@ -9,5 +10,5 @@ fn case() {
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stderr_matches(file!["stderr.log"]);
.stderr_matches(str![""]);
}
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/add_basic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -29,7 +30,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/add_multiple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -34,7 +35,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/add_toolchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -16,7 +17,7 @@ fn case() {
.current_dir(cwd)
.assert()
.failure()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/change_rename_target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/cyclic_features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -23,7 +24,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/default_features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/deprecated_default_features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -29,7 +30,7 @@ fn case() {
.current_dir(&cwd)
.assert()
.failure()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/deprecated_section/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -29,7 +30,7 @@ fn case() {
.current_dir(&cwd)
.assert()
.failure()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/detect_workspace_inherit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -18,7 +19,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -18,7 +19,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -18,7 +19,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand All @@ -19,7 +20,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/dev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/dev_build_conflict/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -29,7 +30,7 @@ fn case() {
.current_dir(cwd)
.assert()
.code(1)
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/dev_prefer_existing_version/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -31,7 +32,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion tests/testsuite/cargo_add/dry_run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use cargo_test_support::compare::assert_ui;
use cargo_test_support::current_dir;
use cargo_test_support::file;
use cargo_test_support::prelude::*;
use cargo_test_support::str;
use cargo_test_support::Project;

#[cargo_test]
Expand Down Expand Up @@ -29,7 +30,7 @@ fn case() {
.current_dir(cwd)
.assert()
.success()
.stdout_matches(file!["stdout.log"])
.stdout_matches(str![""])
.stderr_matches(file!["stderr.log"]);

assert_ui().subset_matches(current_dir!().join("out"), &project_root);
Expand Down
Empty file.
Loading

0 comments on commit 64ccff2

Please sign in to comment.