Skip to content

Commit 271abb6

Browse files
mitsuhikoarchseer
authored andcommitted
Added escaping tests
1 parent a297b58 commit 271abb6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

helix-core/src/shellwords.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,18 @@ mod test {
243243
];
244244
assert_eq!(expected, result);
245245
}
246+
247+
#[cfg(unix)]
248+
fn test_escaping_unix() {
249+
assert_eq!(escape("foobar"), Cow::Borrowed("foobar"));
250+
assert_eq!(escape("foo bar"), Cow::Borrowed("foo\\ bar"));
251+
assert_eq!(escape("foo\tbar"), Cow::Borrowed("foo\\\tbar"));
252+
}
253+
254+
#[test]
255+
#[cfg(windows)]
256+
fn test_escaping_windows() {
257+
assert_eq!(escape("foobar"), Cow::Borrowed("foobar"));
258+
assert_eq!(escape("foo bar"), Cow::Borrowed("\"foo bar\""));
259+
}
246260
}

0 commit comments

Comments
 (0)