workspace: Update snapbox to 1.2

This commit is contained in:
Fintan Halpenny 2026-06-01 11:50:40 +01:00
parent 09e6147ef9
commit b397b1a249
3 changed files with 21 additions and 18 deletions

19
Cargo.lock generated
View File

@ -3876,9 +3876,12 @@ checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
[[package]]
name = "similar"
version = "2.7.0"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
checksum = "e6505efef05804732ed8a3f2d4f279429eb485bd69d5b0cc6b19cc02005cda16"
dependencies = [
"bstr",
]
[[package]]
name = "siphasher"
@ -3900,11 +3903,11 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "snapbox"
version = "0.4.17"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b831b6e80fbcd2889efa75b185d24005f85981431495f995292b25836519d84"
checksum = "8de56eb4784a2c5c1efede55a0f06fbf481bc12b42b355b9525c15db1e3581a8"
dependencies = [
"anstream 0.6.21",
"anstream 1.0.0",
"anstyle",
"normalize-line-endings",
"similar",
@ -3913,11 +3916,11 @@ dependencies = [
[[package]]
name = "snapbox-macros"
version = "0.3.10"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16569f53ca23a41bb6f62e0a5084aa1661f4814a67fa33696a79073e03a664af"
checksum = "ed4a172e483585ebbc7c7f7d1705ca7e3f94f606ed78caa14805673189fd5455"
dependencies = [
"anstream 0.6.21",
"anstream 1.0.0",
]
[[package]]

View File

@ -70,7 +70,7 @@ serde = { version = "1.0", default-features = false }
serde_json = "1.0"
shlex = "1.1.0"
signature = "2.2"
snapbox = "0.4.3"
snapbox = "1.2"
sqlite = "0.37.0"
tempfile = "3.3.0"
thiserror = { version = "2", default-features = false }

View File

@ -6,7 +6,7 @@ use std::sync;
use std::{env, fs, io, mem};
use snapbox::cmd::{Command, OutputAssert};
use snapbox::{Assert, Substitutions};
use snapbox::{Assert, Redactions};
use thiserror::Error;
const CARGO_TARGET_DIR_DIRNAME: &str = "target";
@ -29,7 +29,7 @@ pub enum Error {
#[error("i/o: {0}")]
Io(#[from] io::Error),
#[error("snapbox: {0}")]
Snapbox(#[from] snapbox::Error),
Snapbox(#[from] snapbox::assert::Error),
}
#[derive(Debug, PartialEq, Eq)]
@ -168,7 +168,7 @@ pub struct TestFormula {
/// Tests to run.
tests: Vec<Test>,
/// Output substitutions.
subs: Substitutions,
subs: Redactions,
}
impl TestFormula {
@ -178,7 +178,7 @@ impl TestFormula {
env: HashMap::new(),
homes: HashMap::new(),
tests: Vec::new(),
subs: Substitutions::new(),
subs: Redactions::new(),
}
}
@ -369,7 +369,7 @@ impl TestFormula {
value: &'static str,
other: impl Into<Cow<'static, str>>,
) -> Result<&mut Self, Error> {
self.subs.insert(value, other)?;
self.subs.insert(value, other.into())?;
Ok(self)
}
@ -399,7 +399,7 @@ impl TestFormula {
}
pub fn run(&mut self) -> Result<bool, io::Error> {
let assert = Assert::new().substitutions(self.subs.clone());
let assert = Assert::new().redact_with(self.subs.clone());
let mut runner = TestRunner::new(self);
fs::create_dir_all(&self.cwd)?;
@ -497,9 +497,9 @@ impl TestFormula {
};
let matches = if test.stderr {
assert.stderr_matches(&expected)
assert.stderr_eq(&expected)
} else {
assert.stdout_matches(&expected)
assert.stdout_eq(&expected)
};
match assertion.exit {
ExitStatus::Success => {
@ -607,7 +607,7 @@ $ rad sync
homes: HashMap::new(),
cwd: cwd.clone(),
env: HashMap::new(),
subs: Substitutions::new(),
subs: Redactions::new(),
tests: vec![
Test {
context: vec![String::from("Let's try to track @dave and @sean:")],