Fix error when HashMap.remove on uninitialized HashMap (#1629)

* HashMap: test removal on uninitialized

* HashMap.remove_entry_for_key: return false on unintialized

* test: switch to temp_init

* release note
This commit is contained in:
Walther Chen
2024-11-18 08:20:32 -05:00
committed by GitHub
parent 295b374b48
commit f39e339726
3 changed files with 13 additions and 1 deletions

View File

@@ -53,4 +53,14 @@ fn void map()
assert(tc.key == list[i].key);
assert(tc.value == list[i].value);
}
}
}
fn void map_remove()
{
Map m;
assert(!@ok(m.remove("A")));
m.temp_init();
assert(!@ok(m.remove("A")));
m.set("A", 0);
assert(@ok(m.remove("A")));
}