Install a temporary memory allocation solution to make the test work

This commit is contained in:
Chelsea Troy 2022-01-02 14:03:10 -06:00
parent a6e2f1152e
commit 39f6bde62c

View file

@ -251,10 +251,15 @@ pub fn expectFailed(
failure_length += 1;
}
pub fn getExpectFailures() [_]Failure {
pub fn getExpectFailures() [*]Failure {
return failures;
}
pub fn deinitFailures() void {
roc_dealloc(failures, @alignOf(Failure));
failure_length = 0;
}
pub fn unsafeReallocate(
source_ptr: [*]u8,
alignment: u32,
@ -321,6 +326,11 @@ test "increfC, static data" {
}
test "expectFailure does something"{
//TODO: Fix whatever is causing this to error out
// defer deinitFailures();
// For now we're doing this instead:
defer std.testing.allocator.destroy(@ptrCast(*[4096]u8, failures));
try std.testing.expectEqual(failure_length, 0);
expectFailed(1, 2, 3, 4);
try std.testing.expectEqual(failure_length, 1);