Skip to content

Commit

Permalink
refactor tests: update assertions to use ends_with for path validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Dec 26, 2024
1 parent e733ca2 commit 58fb9a1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/nexter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod tests {
let mut dirs = Dirs::new("testdata/c".into()).unwrap();
let nexter = build_nexter(NexterType::First);
match nexter.next(&mut dirs, 1) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/a")),
Some(p) => assert!(p.ends_with("testdata/a")),
None => panic!("unexpected None"),
}
}
Expand All @@ -108,7 +108,7 @@ mod tests {
let mut dirs = Dirs::new("testdata/k".into()).unwrap();
let nexter = build_nexter(NexterType::Last);
match nexter.next(&mut dirs, 1) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/z")),
Some(p) => assert!(p.ends_with("testdata/z")),
None => panic!("unexpected None"),
}
}
Expand All @@ -118,15 +118,15 @@ mod tests {
let mut dirs = Dirs::new("testdata/c".into()).unwrap();
let nexter = build_nexter(NexterType::Next);
match nexter.next(&mut dirs, 1) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/d")),
Some(p) => assert!(p.ends_with("testdata/d")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 2) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/e")),
Some(p) => assert!(p.ends_with("testdata/e")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 26) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/z")),
Some(p) => assert!(p.ends_with("testdata/z")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 1) {
Expand All @@ -140,19 +140,19 @@ mod tests {
let mut dirs = Dirs::new("testdata/k".into()).unwrap();
let nexter = build_nexter(NexterType::Previous);
match nexter.next(&mut dirs, 1) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/j")),
Some(p) => assert!(p.ends_with("testdata/j")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 1) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/j")),
Some(p) => assert!(p.ends_with("testdata/j")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 4) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/g")),
Some(p) => assert!(p.ends_with("testdata/g")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 26) {
Some(p) => assert_eq!(p, PathBuf::from("testdata/a")),
Some(p) => assert!(p.ends_with("testdata/a")),
None => panic!("unexpected None"),
}
match nexter.next(&mut dirs, 1) {
Expand Down

0 comments on commit 58fb9a1

Please sign in to comment.