Skip to content

Commit

Permalink
Add tests for NodePath
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Jan 21, 2024
1 parent aab3496 commit 7b44ade
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Tests for `ByteRange`, `BytesRepresentation`, `StorePrefix`, `StoreKey`, `ArrayBuilder`, `ArraySubset`, `GroupBuilder`, `Group`, `NodeName`
- Tests for `ByteRange`, `BytesRepresentation`, `StorePrefix`, `StoreKey`, `ArrayBuilder`, `ArraySubset`, `GroupBuilder`, `Group`, `NodeName`, `NodePath`
- `array_subset::IncompatibleStartEndIndicesError`

### Changed
Expand Down
16 changes: 16 additions & 0 deletions src/node/node_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,19 @@ impl TryFrom<&StorePrefix> for NodePath {
Self::new(&path)
}
}

#[cfg(test)]
mod tests {
use std::path::Path;

use super::*;

#[test]
fn node_path() {
assert!(NodePath::new("/").is_ok());
assert!(NodePath::new("/a/b").is_ok());
assert!(NodePath::new("/a/b/").is_err());
assert!(NodePath::new("/a//b").is_err());
assert_eq!(NodePath::new("/a/b").unwrap().as_path(), Path::new("/a/b/"));
}
}

0 comments on commit 7b44ade

Please sign in to comment.