workspace: Update snapbox to 1.2
This commit is contained in:
parent
09e6147ef9
commit
b397b1a249
|
|
@ -3876,9 +3876,12 @@ checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "similar"
|
name = "similar"
|
||||||
version = "2.7.0"
|
version = "3.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
|
checksum = "e6505efef05804732ed8a3f2d4f279429eb485bd69d5b0cc6b19cc02005cda16"
|
||||||
|
dependencies = [
|
||||||
|
"bstr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "siphasher"
|
name = "siphasher"
|
||||||
|
|
@ -3900,11 +3903,11 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "snapbox"
|
name = "snapbox"
|
||||||
version = "0.4.17"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b831b6e80fbcd2889efa75b185d24005f85981431495f995292b25836519d84"
|
checksum = "8de56eb4784a2c5c1efede55a0f06fbf481bc12b42b355b9525c15db1e3581a8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream 0.6.21",
|
"anstream 1.0.0",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"normalize-line-endings",
|
"normalize-line-endings",
|
||||||
"similar",
|
"similar",
|
||||||
|
|
@ -3913,11 +3916,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "snapbox-macros"
|
name = "snapbox-macros"
|
||||||
version = "0.3.10"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "16569f53ca23a41bb6f62e0a5084aa1661f4814a67fa33696a79073e03a664af"
|
checksum = "ed4a172e483585ebbc7c7f7d1705ca7e3f94f606ed78caa14805673189fd5455"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream 0.6.21",
|
"anstream 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ serde = { version = "1.0", default-features = false }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
shlex = "1.1.0"
|
shlex = "1.1.0"
|
||||||
signature = "2.2"
|
signature = "2.2"
|
||||||
snapbox = "0.4.3"
|
snapbox = "1.2"
|
||||||
sqlite = "0.37.0"
|
sqlite = "0.37.0"
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
thiserror = { version = "2", default-features = false }
|
thiserror = { version = "2", default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use std::sync;
|
||||||
use std::{env, fs, io, mem};
|
use std::{env, fs, io, mem};
|
||||||
|
|
||||||
use snapbox::cmd::{Command, OutputAssert};
|
use snapbox::cmd::{Command, OutputAssert};
|
||||||
use snapbox::{Assert, Substitutions};
|
use snapbox::{Assert, Redactions};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
const CARGO_TARGET_DIR_DIRNAME: &str = "target";
|
const CARGO_TARGET_DIR_DIRNAME: &str = "target";
|
||||||
|
|
@ -29,7 +29,7 @@ pub enum Error {
|
||||||
#[error("i/o: {0}")]
|
#[error("i/o: {0}")]
|
||||||
Io(#[from] io::Error),
|
Io(#[from] io::Error),
|
||||||
#[error("snapbox: {0}")]
|
#[error("snapbox: {0}")]
|
||||||
Snapbox(#[from] snapbox::Error),
|
Snapbox(#[from] snapbox::assert::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
|
@ -168,7 +168,7 @@ pub struct TestFormula {
|
||||||
/// Tests to run.
|
/// Tests to run.
|
||||||
tests: Vec<Test>,
|
tests: Vec<Test>,
|
||||||
/// Output substitutions.
|
/// Output substitutions.
|
||||||
subs: Substitutions,
|
subs: Redactions,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestFormula {
|
impl TestFormula {
|
||||||
|
|
@ -178,7 +178,7 @@ impl TestFormula {
|
||||||
env: HashMap::new(),
|
env: HashMap::new(),
|
||||||
homes: HashMap::new(),
|
homes: HashMap::new(),
|
||||||
tests: Vec::new(),
|
tests: Vec::new(),
|
||||||
subs: Substitutions::new(),
|
subs: Redactions::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,7 +369,7 @@ impl TestFormula {
|
||||||
value: &'static str,
|
value: &'static str,
|
||||||
other: impl Into<Cow<'static, str>>,
|
other: impl Into<Cow<'static, str>>,
|
||||||
) -> Result<&mut Self, Error> {
|
) -> Result<&mut Self, Error> {
|
||||||
self.subs.insert(value, other)?;
|
self.subs.insert(value, other.into())?;
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -399,7 +399,7 @@ impl TestFormula {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(&mut self) -> Result<bool, io::Error> {
|
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);
|
let mut runner = TestRunner::new(self);
|
||||||
|
|
||||||
fs::create_dir_all(&self.cwd)?;
|
fs::create_dir_all(&self.cwd)?;
|
||||||
|
|
@ -497,9 +497,9 @@ impl TestFormula {
|
||||||
};
|
};
|
||||||
|
|
||||||
let matches = if test.stderr {
|
let matches = if test.stderr {
|
||||||
assert.stderr_matches(&expected)
|
assert.stderr_eq(&expected)
|
||||||
} else {
|
} else {
|
||||||
assert.stdout_matches(&expected)
|
assert.stdout_eq(&expected)
|
||||||
};
|
};
|
||||||
match assertion.exit {
|
match assertion.exit {
|
||||||
ExitStatus::Success => {
|
ExitStatus::Success => {
|
||||||
|
|
@ -607,7 +607,7 @@ $ rad sync
|
||||||
homes: HashMap::new(),
|
homes: HashMap::new(),
|
||||||
cwd: cwd.clone(),
|
cwd: cwd.clone(),
|
||||||
env: HashMap::new(),
|
env: HashMap::new(),
|
||||||
subs: Substitutions::new(),
|
subs: Redactions::new(),
|
||||||
tests: vec![
|
tests: vec![
|
||||||
Test {
|
Test {
|
||||||
context: vec![String::from("Let's try to track @dave and @sean:")],
|
context: vec![String::from("Let's try to track @dave and @sean:")],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue