Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jan 17, 2024
1 parent d9e31e8 commit 4c49e3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lazy_index_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
}

pub fn is_empty(&self) -> bool {
self.get_map().is_empty()
self.vec.is_empty()
}

pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V>
Expand Down
4 changes: 4 additions & 0 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,13 @@ fn test_4302_int_err() {
#[test]
fn lazy_index_map_pretty() {
let mut map = LazyIndexMap::new();
assert!(map.is_empty());
map.insert("foo".to_string(), JsonValue::Str("bar".to_string()));
assert!(!map.is_empty());
map.insert("spam".to_string(), JsonValue::Null);
assert_eq!(format!("{map:?}"), r#"{"foo": Str("bar"), "spam": Null}"#);
let keys = map.keys().collect::<Vec<_>>();
assert_eq!(keys, vec!["foo", "spam"]);
}

#[test]
Expand Down

0 comments on commit 4c49e3e

Please sign in to comment.