Skip to content

Commit 825f308

Browse files
author
curious-rabbit
committed
formatting
1 parent 63a7d85 commit 825f308

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/exec/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ impl CommandTemplate {
243243
}
244244

245245
if args[0].has_tokens() {
246-
bail!("First argument of --exec/--exec-batch must be a fixed executable, not a placeholder");
246+
bail!(
247+
"First argument of --exec/--exec-batch must be a fixed executable, not a placeholder"
248+
);
247249
}
248250

249251
// If a placeholder token was not supplied, append one at the end of the command.

src/sanitize.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@ mod tests {
3232

3333
#[test]
3434
fn preserves_safe_content() {
35-
for s in ["hello.txt", "résumé.pdf", "文档.txt", "🦀.rs", "a\tb", "a\u{FFFD}b"] {
36-
assert!(matches!(sanitize_for_terminal(s), Cow::Borrowed(_)), "{s:?}");
35+
for s in [
36+
"hello.txt",
37+
"résumé.pdf",
38+
"文档.txt",
39+
"🦀.rs",
40+
"a\tb",
41+
"a\u{FFFD}b",
42+
] {
43+
assert!(
44+
matches!(sanitize_for_terminal(s), Cow::Borrowed(_)),
45+
"{s:?}"
46+
);
3747
assert_eq!(sanitize_for_terminal(s), s);
3848
}
3949
}
@@ -83,6 +93,9 @@ mod tests {
8393
fn strips_c1_csi_and_osc_initiators() {
8494
// U+009B is CSI, U+009D is OSC; dangerous on 8-bit-control terminals.
8595
assert_eq!(sanitize_for_terminal("\u{9b}31m"), "\\x9B31m");
86-
assert_eq!(sanitize_for_terminal("\u{9d}0;pwned\u{9c}"), "\\x9D0;pwned\\x9C");
96+
assert_eq!(
97+
sanitize_for_terminal("\u{9d}0;pwned\u{9c}"),
98+
"\\x9D0;pwned\\x9C"
99+
);
87100
}
88101
}

0 commit comments

Comments
 (0)