Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
gc.gc: Add debug=SENTINEL unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Mar 24, 2015
1 parent 03ab3d6 commit f901b5f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -3275,3 +3275,21 @@ unittest
GC.free(p);
assert(p[2] == 0xF2F2F2F2);
}

debug (SENTINEL)
unittest
{
import core.memory;
auto p = cast(ubyte*)GC.malloc(1);
assert(p[-1] == 0xF4);
assert(p[ 1] == 0xF5);

p[1] = 0;
bool thrown;
try
GC.free(p);
catch (Error e)
thrown = true;
p[1] = 0xF5;
assert(thrown);
}

0 comments on commit f901b5f

Please sign in to comment.