authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 14:57:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 14:57:13-07:00
log02b8d881539a665212b4ce4c174329cfd503ab54
tree4afea5e1d5795fa31aa53d8c73326400f13b2ea7
parentc42763f8cc9223fc43ac3478a5f15d4bd9f438e4

stage2: add test coverage for `@embedFile` outside package path

closes #6662

1 files changed, 12 insertions(+), 0 deletions(-)

test/compile_errors.zig+12
......@@ -3,6 +3,18 @@ const builtin = @import("builtin");
33const TestContext = @import("../src/test.zig").TestContext;
44
55pub fn addCases(ctx: *TestContext) !void {
6 {
7 var case = ctx.obj("stage2 compile errors", .{});
8
9 case.addError(
10 \\export fn a() usize {
11 \\ return @embedFile("/root/foo").len;
12 \\}
13 , &[_][]const u8{
14 ":2:12: error: embed of file outside package path: '/root/foo'",
15 });
16 }
17
618 ctx.objErrStage1("issue #9346: return outside of function scope",
719 \\pub const empty = return 1;
820 , &.{"tmp.zig:1:19: error: 'return' outside function scope"});