summaryrefslogtreecommitdiff
path: root/test/livestructlit.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-06-08 15:02:26 -0400
committerOri Bernstein <ori@eigenstate.org>2013-06-08 15:02:26 -0400
commitf16eddc8b5b4c20a4aef509d3b9f69ef83b49b4c (patch)
tree384195c74372441b59f002feb8a3e665bfee18a2 /test/livestructlit.myr
parentfbbdeabda88a0262e59d68fcf5227c165d673afe (diff)
downloadmc-f16eddc8b5b4c20a4aef509d3b9f69ef83b49b4c.tar.gz
Add test for live struct literals.
Diffstat (limited to 'test/livestructlit.myr')
-rw-r--r--test/livestructlit.myr20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/livestructlit.myr b/test/livestructlit.myr
new file mode 100644
index 0000000..dfe0386
--- /dev/null
+++ b/test/livestructlit.myr
@@ -0,0 +1,20 @@
+use std
+
+/* checks that we can create struct literals with named initializers.
+ exits with 42. */
+type t = struct
+ a : int
+ b : byte
+ c : byte[:]
+;;
+
+const main = {
+ var v : t
+
+ v = [.a=foo(), .b=42, .c="foo"]
+ -> v.a
+}
+
+const foo = {
+ -> 21
+}