Skip to content

Commit

Permalink
add tests for from_backslash and from_backslash_lossy
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Jun 29, 2022
1 parent 497a3b9 commit 759321a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ fn from_slash_lossy() {
}
}

#[test]
fn from_backslash() {
for (input, expected) in FROM_SLASH_TESTS.iter() {
let input = input.replace('/', r"\");
assert_eq!(&PathBuf::from_backslash(input), expected);
}
}

#[test]
fn from_backslash_lossy() {
for (input, expected) in FROM_SLASH_TESTS.iter() {
let input = input.replace('/', r"\");
let input: &OsStr = input.as_ref();
assert_eq!(&PathBuf::from_backslash_lossy(input), expected);
}
}

lazy_static! {
static ref TO_SLASH_TESTS: Vec<(PathBuf, String)> = {
[
Expand Down

0 comments on commit 759321a

Please sign in to comment.