diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-04 03:31:57 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-04 03:31:57 -0700 |
| commit | 44d5d008d025c7f081d87da393363f40616bfe47 (patch) | |
| tree | af63ee97991dd83528b21a4c4fccd20abafa629b /test/run_tests.cpp | |
| parent | 333a3221275a7bea929f9eb1e2642043027c25f1 (diff) | |
| download | zig-44d5d008d025c7f081d87da393363f40616bfe47.tar.gz zig-44d5d008d025c7f081d87da393363f40616bfe47.zip | |
partial import segregation
See #3
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 7cc994a1ba..1cb837753a 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -173,6 +173,44 @@ pub fn print_text() { )SOURCE"); } + { + TestCase *tc = add_simple_case("import segregation", R"SOURCE( +use "foo.zig"; +use "bar.zig"; + +pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 { + foo_function(); + bar_function(); + return 0; +} + )SOURCE", "OK\nOK\n"); + + add_source_file(tc, "foo.zig", R"SOURCE( +use "std.zig"; +pub fn foo_function() { + print_str("OK\n"); +} + )SOURCE"); + + add_source_file(tc, "bar.zig", R"SOURCE( +use "other.zig"; +use "std.zig"; + +pub fn bar_function() { + if (foo_function()) { + print_str("OK\n"); + } +} + )SOURCE"); + + add_source_file(tc, "other.zig", R"SOURCE( +pub fn foo_function() -> bool { + // this one conflicts with the one from foo + return true; +} + )SOURCE"); + } + add_simple_case("if statements", R"SOURCE( use "std.zig"; |
