Skip to content

Commit

Permalink
More tests for KeyPath
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jan 13, 2025
1 parent b3b1deb commit 132cc1d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/keypath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ mod tests {
use assert_matches::assert_matches;
use rstest::rstest;

#[rstest]
#[case("foo", "foo")]
#[case("foo/bar/baz", "baz")]
fn test_name(#[case] p: KeyPath, #[case] name: &str) {
assert_eq!(p.name(), name);
}

#[rstest]
#[case("foo", None, "foo")]
#[case("foo/bar", Some("foo"), "bar")]
#[case("foo/bar/baz", Some("foo/bar"), "baz")]
fn test_split(#[case] p: KeyPath, #[case] dirname: Option<&str>, #[case] filename: &str) {
let (d, f) = p.split();
assert_eq!(d, dirname);
assert_eq!(f, filename);
}

#[rstest]
#[case("foo.nwb")]
#[case("foo/bar.nwb")]
Expand Down

0 comments on commit 132cc1d

Please sign in to comment.