Skip to content

Commit

Permalink
Added escaping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Oct 16, 2022
1 parent de80ef3 commit 457809b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions helix-core/src/shellwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,19 @@ mod test {
];
assert_eq!(expected, result);
}

#[test]
#[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 457809b

Please sign in to comment.