diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-15 20:08:53 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-15 20:08:53 -0700 |
| commit | aa56f016f73063371431b8b2587538c79af97bd9 (patch) | |
| tree | 30ab1eecc5161a9cf60971735537c29af484b187 /test/run_tests.cpp | |
| parent | 5a8822c714e4ee2d442e76f36213d119530f0fea (diff) | |
| download | zig-aa56f016f73063371431b8b2587538c79af97bd9.tar.gz zig-aa56f016f73063371431b8b2587538c79af97bd9.zip | |
support addressof operator and struct pointer field access
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index e7729e5a42..8fd17c4d1a 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -569,6 +569,11 @@ export fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { foo.a += 1; foo.b = foo.a == 1; test_foo(foo); + test_mutation(&foo); + if foo.c != 100 { + print_str("BAD\n"); + } + print_str("OK\n"); return 0; } struct Foo { @@ -577,10 +582,13 @@ struct Foo { c : f32, } fn test_foo(foo : Foo) { - if foo.b { - print_str("OK\n"); + if !foo.b { + print_str("BAD\n"); } } +fn test_mutation(foo : &Foo) { + foo.c = 100; +} )SOURCE", "OK\n"); add_simple_case("global variables", R"SOURCE( |
