aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/expr-alt-struct.rs
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-04-02 19:32:34 -0400
committerBrian Anderson <[email protected]>2011-04-02 20:35:51 -0400
commit1326d424c96479864e80b25e24994d7cd5085920 (patch)
tree376f880acd662ec52f8624cc65a02f3f8eb8e82a /src/test/run-pass/expr-alt-struct.rs
parentAdd FIXMEs around type handling in trans_if, trans_alt (diff)
downloadrust-1326d424c96479864e80b25e24994d7cd5085920.tar.xz
rust-1326d424c96479864e80b25e24994d7cd5085920.zip
Add more tests for alt expressions
Diffstat (limited to 'src/test/run-pass/expr-alt-struct.rs')
-rw-r--r--src/test/run-pass/expr-alt-struct.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs
new file mode 100644
index 00000000..31406969
--- /dev/null
+++ b/src/test/run-pass/expr-alt-struct.rs
@@ -0,0 +1,35 @@
+// xfail-boot
+// -*- rust -*-
+
+// Tests for alt as expressions resulting in structural types
+
+fn test_rec() {
+ auto res = alt (true) {
+ case (true) {
+ rec(i = 100)
+ }
+ };
+ check (res == rec(i = 100));
+}
+
+fn test_tag() {
+ tag mood {
+ happy;
+ sad;
+ }
+
+ auto res = alt (true) {
+ case (true) {
+ happy
+ }
+ case (false) {
+ sad
+ }
+ };
+ check (res == happy);
+}
+
+fn main() {
+ test_rec();
+ test_tag();
+} \ No newline at end of file