mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 14:54:30 +00:00
Merge pull request #545 from reitermarkus/linear-map-borrow
Add test for borrowed `LinearMap` key.
This commit is contained in:
commit
1a33fec858
@ -570,6 +570,18 @@ mod test {
|
||||
static mut _L: LinearMap<i32, i32, 8> = LinearMap::new();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn borrow() {
|
||||
use crate::String;
|
||||
|
||||
let mut map = LinearMap::<_, _, 8>::new();
|
||||
|
||||
let s = String::<64>::try_from("Hello, world!").unwrap();
|
||||
map.insert(s, 42).unwrap();
|
||||
|
||||
assert_eq!(map.get("Hello, world!").unwrap(), &42);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_eq() {
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user