mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
@@ -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")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user