Fix test call to jsruntime.loadEnv

Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
Francis Bouvier
2023-03-01 11:47:06 +01:00
parent 3fcc507cce
commit 081daa1245
2 changed files with 5 additions and 5 deletions

View File

@@ -58,8 +58,6 @@ pub fn main() !void {
defer doc.deinit(); defer doc.deinit();
try doc.parse(html); try doc.parse(html);
std.debug.print("ok\n", .{});
// remove socket file of internal server // remove socket file of internal server
// reuse_address (SO_REUSEADDR flag) does not seems to work on unix socket // reuse_address (SO_REUSEADDR flag) does not seems to work on unix socket
// see: https://gavv.net/articles/unix-socket-reuse/ // see: https://gavv.net/articles/unix-socket-reuse/
@@ -72,7 +70,7 @@ pub fn main() !void {
// alloc // alloc
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer _ = arena.deinit(); defer arena.deinit();
// server // server
var addr = try std.net.Address.initUnix(socket_path); var addr = try std.net.Address.initUnix(socket_path);

View File

@@ -40,7 +40,9 @@ test {
const vm = jsruntime.VM.init(); const vm = jsruntime.VM.init();
defer vm.deinit(); defer vm.deinit();
var alloc = jsruntime.bench_allocator(std.testing.allocator); var bench_alloc = jsruntime.bench_allocator(std.testing.allocator);
var arena_alloc = std.heap.ArenaAllocator.init(bench_alloc.allocator());
defer arena_alloc.deinit();
try jsruntime.loadEnv(alloc.allocator(), false, testsExecFn, apis); try jsruntime.loadEnv(&arena_alloc, testsExecFn, apis);
} }