Skip to content

Commit

Permalink
Added escaping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko authored and archseer committed Nov 1, 2022
1 parent a297b58 commit 271abb6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions helix-core/src/shellwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,18 @@ mod test {
];
assert_eq!(expected, result);
}

#[cfg(unix)]
fn test_escaping_unix() {
assert_eq!(escape("foobar"), Cow::Borrowed("foobar"));
assert_eq!(escape("foo bar"), Cow::Borrowed("foo\\ bar"));
assert_eq!(escape("foo\tbar"), Cow::Borrowed("foo\\\tbar"));
}

#[test]
#[cfg(windows)]
fn test_escaping_windows() {
assert_eq!(escape("foobar"), Cow::Borrowed("foobar"));
assert_eq!(escape("foo bar"), Cow::Borrowed("\"foo bar\""));
}
}

0 comments on commit 271abb6

Please sign in to comment.