2021-05-04 19:23:22 +01:00
|
|
|
fn doTheTest() !void {
|
2022-02-23 07:46:28 +00:00
|
|
|
const src = @src(); // do not move
|
2020-06-18 19:03:08 +01:00
|
|
|
|
2022-02-23 07:46:28 +00:00
|
|
|
try expect(src.line == 2);
|
2021-05-04 19:23:22 +01:00
|
|
|
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
|
|
|
}
|
2022-02-23 07:46:28 +00:00
|
|
|
|
|
|
|
const std = @import("std");
|
|
|
|
const builtin = @import("builtin");
|
|
|
|
const expect = std.testing.expect;
|
|
|
|
|
|
|
|
test "@src" {
|
|
|
|
if (builtin.zig_backend != .stage1) return error.SkipZigTest;
|
|
|
|
|
|
|
|
try doTheTest();
|
|
|
|
}
|