mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 23:29:03 +00:00
stage2: add test coverage for @embedFile outside package path
closes #6662
This commit is contained in:
parent
c42763f8cc
commit
02b8d88153
1 changed files with 12 additions and 0 deletions
|
|
@ -3,6 +3,18 @@ const builtin = @import("builtin");
|
||||||
const TestContext = @import("../src/test.zig").TestContext;
|
const TestContext = @import("../src/test.zig").TestContext;
|
||||||
|
|
||||||
pub fn addCases(ctx: *TestContext) !void {
|
pub fn addCases(ctx: *TestContext) !void {
|
||||||
|
{
|
||||||
|
var case = ctx.obj("stage2 compile errors", .{});
|
||||||
|
|
||||||
|
case.addError(
|
||||||
|
\\export fn a() usize {
|
||||||
|
\\ return @embedFile("/root/foo").len;
|
||||||
|
\\}
|
||||||
|
, &[_][]const u8{
|
||||||
|
":2:12: error: embed of file outside package path: '/root/foo'",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ctx.objErrStage1("issue #9346: return outside of function scope",
|
ctx.objErrStage1("issue #9346: return outside of function scope",
|
||||||
\\pub const empty = return 1;
|
\\pub const empty = return 1;
|
||||||
, &.{"tmp.zig:1:19: error: 'return' outside function scope"});
|
, &.{"tmp.zig:1:19: error: 'return' outside function scope"});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue