Skip to content

Commit eafc743

Browse files
committed
chore: Update to snapbox 0.6
We needed to tweak the redactions because snapbox no longer normalizes slashes on redactions unless the data type is a `PathBuf`.
1 parent 0bd034c commit eafc743

File tree

4 files changed

+69
-72
lines changed

4 files changed

+69
-72
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ sha1 = "0.10.6"
9191
sha2 = "0.10.8"
9292
shell-escape = "0.1.5"
9393
supports-hyperlinks = "3.0.0"
94-
snapbox = { version = "0.5.14", features = ["diff", "dir", "term-svg"] }
94+
snapbox = { version = "0.6.5", features = ["diff", "dir", "term-svg"] }
9595
tar = { version = "0.4.40", default-features = false }
9696
tempfile = "3.10.1"
9797
thiserror = "1.0.59"

crates/cargo-test-support/src/compare.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,12 @@ pub fn assert_ui() -> snapbox::Assert {
8080
// Use `from_file_path` instead of `from_dir_path` so the trailing slash is
8181
// put in the users output, rather than hidden in the variable
8282
let root_url = url::Url::from_file_path(&root).unwrap().to_string();
83-
let root = root.display().to_string();
8483

8584
let mut subs = snapbox::Redactions::new();
86-
subs.extend([(
87-
"[EXE]",
88-
std::borrow::Cow::Borrowed(std::env::consts::EXE_SUFFIX),
89-
)])
90-
.unwrap();
91-
subs.insert("[ROOT]", std::borrow::Cow::Owned(root))
92-
.unwrap();
93-
subs.insert("[ROOTURL]", std::borrow::Cow::Owned(root_url))
85+
subs.extend([("[EXE]", std::env::consts::EXE_SUFFIX)])
9486
.unwrap();
87+
subs.insert("[ROOT]", root).unwrap();
88+
subs.insert("[ROOTURL]", root_url).unwrap();
9589
snapbox::Assert::new()
9690
.action_env(snapbox::assert::DEFAULT_ACTION_ENV)
9791
.substitutions(subs)

src/cargo/util/toml/embedded.rs

Lines changed: 63 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -281,24 +281,25 @@ mod test_expand {
281281
snapbox::assert_data_eq!(
282282
si!(r#"fn main() {}"#),
283283
str![[r#"
284-
[[bin]]
285-
name = "test-"
286-
path = "/home/me/test.rs"
287-
288-
[package]
289-
autobenches = false
290-
autobins = false
291-
autoexamples = false
292-
autotests = false
293-
build = false
294-
edition = "2021"
295-
name = "test-"
296-
297-
[profile.release]
298-
strip = true
299-
300-
[workspace]
301-
"#]]
284+
[[bin]]
285+
name = "test-"
286+
path = "/home/me/test.rs"
287+
288+
[package]
289+
autobenches = false
290+
autobins = false
291+
autoexamples = false
292+
autotests = false
293+
build = false
294+
edition = "2021"
295+
name = "test-"
296+
297+
[profile.release]
298+
strip = true
299+
300+
[workspace]
301+
302+
"#]]
302303
);
303304
}
304305

@@ -312,27 +313,28 @@ time="0.1.25"
312313
fn main() {}
313314
"#),
314315
str![[r#"
315-
[[bin]]
316-
name = "test-"
317-
path = [..]
318-
319-
[dependencies]
320-
time = "0.1.25"
321-
322-
[package]
323-
autobenches = false
324-
autobins = false
325-
autoexamples = false
326-
autotests = false
327-
build = false
328-
edition = "2021"
329-
name = "test-"
330-
331-
[profile.release]
332-
strip = true
333-
334-
[workspace]
335-
"#]]
316+
[[bin]]
317+
name = "test-"
318+
path = [..]
319+
320+
[dependencies]
321+
time = "0.1.25"
322+
323+
[package]
324+
autobenches = false
325+
autobins = false
326+
autoexamples = false
327+
autotests = false
328+
build = false
329+
edition = "2021"
330+
name = "test-"
331+
332+
[profile.release]
333+
strip = true
334+
335+
[workspace]
336+
337+
"#]]
336338
);
337339
}
338340

@@ -346,27 +348,28 @@ time="0.1.25"
346348
fn main() {}
347349
"#),
348350
str![[r#"
349-
[[bin]]
350-
name = "test-"
351-
path = [..]
352-
353-
[dependencies]
354-
time = "0.1.25"
355-
356-
[package]
357-
autobenches = false
358-
autobins = false
359-
autoexamples = false
360-
autotests = false
361-
build = false
362-
edition = "2021"
363-
name = "test-"
364-
365-
[profile.release]
366-
strip = true
367-
368-
[workspace]
369-
"#]]
351+
[[bin]]
352+
name = "test-"
353+
path = [..]
354+
355+
[dependencies]
356+
time = "0.1.25"
357+
358+
[package]
359+
autobenches = false
360+
autobins = false
361+
autoexamples = false
362+
autotests = false
363+
build = false
364+
edition = "2021"
365+
name = "test-"
366+
367+
[profile.release]
368+
strip = true
369+
370+
[workspace]
371+
372+
"#]]
370373
);
371374
}
372375
}

0 commit comments

Comments
 (0)