aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-23 03:19:22 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-23 03:19:22 -0700
commite21369a1539063773734432993bc2c23680f0913 (patch)
treeb48333c170245c8e95f7dd75bcef81a84d4dc9f2 /test/run_tests.cpp
parentebd7aeb5411c8dba35d6898524928d7ee905c06b (diff)
downloadzig-e21369a1539063773734432993bc2c23680f0913.tar.gz
zig-e21369a1539063773734432993bc2c23680f0913.zip
codegen: support byvalue struct assignment
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 35fedabc87..b57228e50e 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -574,6 +574,7 @@ export fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 {
print_str("BAD\n");
}
test_point_to_self();
+ test_byval_assign();
print_str("OK\n");
return 0;
}
@@ -612,6 +613,18 @@ fn test_point_to_self() {
print_str("BAD\n");
}
}
+fn test_byval_assign() {
+ var foo1 : Foo;
+ var foo2 : Foo;
+
+ foo1.a = 1234;
+
+ if foo2.a != 0 { print_str("BAD\n"); }
+
+ foo2 = foo1;
+
+ if foo2.a != 1234 { print_str("BAD - byval assignment failed\n"); }
+}
)SOURCE", "OK\n");
add_simple_case("global variables", R"SOURCE(