zig/test/behavior/src.zig

22 lines
549 B
Zig
Raw Normal View History

2020-06-18 19:03:08 +01:00
const std = @import("std");
2022-02-22 13:15:09 +00:00
const builtin = @import("builtin");
2020-06-18 19:03:08 +01:00
const expect = std.testing.expect;
test "@src" {
2022-02-22 21:33:57 +00:00
// TODO why is this failing on stage1?
return error.SkipZigTest;
2022-02-22 13:15:09 +00:00
2022-02-22 21:33:57 +00:00
// try doTheTest();
2020-06-18 19:03:08 +01:00
}
fn doTheTest() !void {
2020-06-18 19:03:08 +01:00
const src = @src();
try expect(src.line == 9);
try expect(src.column == 17);
try expect(std.mem.endsWith(u8, src.fn_name, "doTheTest"));
try expect(std.mem.endsWith(u8, src.file, "src.zig"));
try expect(src.fn_name[src.fn_name.len] == 0);
try expect(src.file[src.file.len] == 0);
2020-06-18 19:03:08 +01:00
}