Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromefroe committed Jun 30, 2023
1 parent dbbf20c commit 9cb02d1
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,11 +1451,26 @@ mod tests {
fn test_try_get_or_insert() {
let mut cache = LruCache::new(NonZeroUsize::new(2).unwrap());

assert_eq!(cache.try_get_or_insert::<_, &str>("apple", || Ok("red")), Ok(&"red"));
assert_eq!(cache.try_get_or_insert::<_, &str>("apple", || Err("failed")), Ok(&"red"));
assert_eq!(cache.try_get_or_insert::<_, &str>("banana", || Ok("orange")), Ok(&"orange"));
assert_eq!(cache.try_get_or_insert::<_, &str>("lemon", || Err("failed")), Err("failed"));
assert_eq!(cache.try_get_or_insert::<_, &str>("banana", || Err("failed")), Ok(&"orange"));
assert_eq!(
cache.try_get_or_insert::<_, &str>("apple", || Ok("red")),
Ok(&"red")
);
assert_eq!(
cache.try_get_or_insert::<_, &str>("apple", || Err("failed")),
Ok(&"red")
);
assert_eq!(
cache.try_get_or_insert::<_, &str>("banana", || Ok("orange")),
Ok(&"orange")
);
assert_eq!(
cache.try_get_or_insert::<_, &str>("lemon", || Err("failed")),
Err("failed")
);
assert_eq!(
cache.try_get_or_insert::<_, &str>("banana", || Err("failed")),
Ok(&"orange")
);
}

#[test]
Expand Down

0 comments on commit 9cb02d1

Please sign in to comment.