blob: 7802834b3a7b98a6d0f8ac692ed1964b97ce08f9 [file] [log] [blame]
Graydon Hoarece729932011-06-15 18:19:501
2
3
Brian Anderson1326d422011-04-02 23:32:344// -*- rust -*-
5
6// Tests for alt as expressions resulting in structural types
Brian Anderson1326d422011-04-02 23:32:347fn test_rec() {
Graydon Hoarece729932011-06-15 18:19:508 auto res = alt (true) { case (true) { rec(i=100) } };
9 assert (res == rec(i=100));
Brian Anderson1326d422011-04-02 23:32:3410}
11
12fn test_tag() {
Graydon Hoarece729932011-06-15 18:19:5013 tag mood { happy; sad; }
14 auto res = alt (true) { case (true) { happy } case (false) { sad } };
15 assert (res == happy);
Brian Anderson1326d422011-04-02 23:32:3416}
17
Graydon Hoarece729932011-06-15 18:19:5018fn main() { test_rec(); test_tag(); }