mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add dbg impl for use with roc test
This commit is contained in:
parent
546e0778c4
commit
6c60da2832
4 changed files with 47 additions and 2 deletions
11
crates/compiler/builtins/bitcode/src/dbg.zig
Normal file
11
crates/compiler/builtins/bitcode/src/dbg.zig
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue