mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Test runner will also check for leaks.
- `write` of qoi would leak memory. - Issue when having an empty `Path` or just "." - `set_env` would leak memory.
This commit is contained in:
@@ -7,6 +7,7 @@ fn void copy_map() @test
|
||||
{
|
||||
TrackingAllocator alloc;
|
||||
alloc.init(allocator::heap());
|
||||
defer alloc.free();
|
||||
assert(alloc.allocated() == 0);
|
||||
mem::@scoped(&alloc)
|
||||
{
|
||||
@@ -39,7 +40,8 @@ fn void copy_map() @test
|
||||
fn void copy_keys() @test
|
||||
{
|
||||
String[] y;
|
||||
@pool() {
|
||||
@pool()
|
||||
{
|
||||
IntMap x;
|
||||
x.temp_init();
|
||||
x.set("hello", 0); // keys copied into temp hashmap
|
||||
@@ -47,4 +49,6 @@ fn void copy_keys() @test
|
||||
// end of pool: hashmap and its copied-in keys dropped
|
||||
};
|
||||
assert(y == {"hello"});
|
||||
foreach(key : y) free(key);
|
||||
free(y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user