diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-18 15:47:21 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-18 15:47:21 -0700 |
| commit | 5e33175517807c6e50fe66f8d6c65fc094c8e11a (patch) | |
| tree | 004fc843be6c452f0c925915d080b8ab09432723 /test/run_tests.cpp | |
| parent | 832454f38b3ef635ee03fb54c382d8be02ac7c9e (diff) | |
| download | zig-5e33175517807c6e50fe66f8d6c65fc094c8e11a.tar.gz zig-5e33175517807c6e50fe66f8d6c65fc094c8e11a.zip | |
add @embed_file builtin function
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 7b5b90e4ae..fdc03b0ae0 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -600,6 +600,20 @@ fn do_test() -> %void { } fn its_gonna_pass() -> %void { } )SOURCE", "before\nafter\ndefer3\ndefer1\n"); + + + { + TestCase *tc = add_simple_case("@embed_file", R"SOURCE( +const foo_txt = @embed_file("foo.txt"); +const io = @import("std").io; + +pub fn main(args: [][]u8) -> %void { + %%io.stdout.printf(foo_txt); +} + )SOURCE", "1234\nabcd\n"); + + add_source_file(tc, "foo.txt", "1234\nabcd\n"); + } } @@ -1173,6 +1187,10 @@ fn fibbonaci(x: i32) -> i32 { ".tmp_source.zig:3:1: error: function evaluation exceeded 1000 branches", ".tmp_source.zig:2:37: note: called from here", ".tmp_source.zig:4:40: note: quota exceeded here"); + + add_compile_fail_case("@embed_file with bogus file", R"SOURCE( +const resource = @embed_file("bogus.txt"); + )SOURCE", 1, ".tmp_source.zig:2:18: error: unable to find './bogus.txt'"); } ////////////////////////////////////////////////////////////////////////////// |
