add dbg impl for use with roc test

This commit is contained in:
Brendan Hansknecht 2023-12-02 16:39:20 -08:00
parent 546e0778c4
commit 6c60da2832
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
4 changed files with 47 additions and 2 deletions

View file

@ -0,0 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const RocStr = @import("str.zig").RocStr;
// An optional debug impl to be called during `roc test`
pub fn dbg_impl(loc: *const RocStr, src: *const RocStr, msg: *const RocStr) callconv(.C) void {
if (builtin.target.cpu.arch != .wasm32) {
const stderr = std.io.getStdErr().writer();
stderr.print("[{s}] {s} = {s}\n", .{ loc.asSlice(), src.asSlice(), msg.asSlice() }) catch unreachable;
}
}