Skip to content

Commit 628eed6

Browse files
committed
Add test for borrowed LinearMap key.
1 parent 64fee10 commit 628eed6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/linear_map.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,18 @@ mod test {
570570
static mut _L: LinearMap<i32, i32, 8> = LinearMap::new();
571571
}
572572

573+
#[test]
574+
fn borrow() {
575+
use crate::String;
576+
577+
let mut map = LinearMap::<_, _, 8>::new();
578+
579+
let s = String::<64>::try_from("Hello, world!").unwrap();
580+
map.insert(s, 42).unwrap();
581+
582+
assert_eq!(map.get("Hello, world!").unwrap(), &42);
583+
}
584+
573585
#[test]
574586
fn partial_eq() {
575587
{

0 commit comments

Comments
 (0)