# HG changeset patch # User Anders Halager # Date 1208728422 -7200 # Node ID 52eb0eb92e911bcaba830074e822ad3d9a58790e # Parent 858b9805843dda11706d6cf370d2d0e5161f8ea0 Testcases for switch diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_1.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_1.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,8 @@ + +void main(int x) +{ + switch (x) + { + } +} + diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_2.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_2.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,9 @@ + +void main(int x) +{ + switch (x) + { + case 1: + } +} + diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_3.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_3.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,15 @@ + +void main(int x) +{ + switch (x) + { + case 1, 2: + x = 2; + return; + case 3, 4: + x = 1; + return; + default: + } +} + diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_4.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_4.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,16 @@ + +int main(int x) +{ + switch (x) + { + case 1, 2: + x = 2; + return x; + case 3, 4: + x = 1; + return x; + default: + return 0; + } +} + diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_5.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_5.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,12 @@ +//test fail +int main(int x) +{ + switch (x) + { + default: + return 0; + default: + return 1; + } +} + diff -r 858b9805843d -r 52eb0eb92e91 tests/code/switch_6.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/switch_6.d Sun Apr 20 23:53:42 2008 +0200 @@ -0,0 +1,12 @@ +//test fail +int main(int x) +{ + switch (x) + { + case 1, 2: + return 0; + case 2, 3: + return 1; + } +} +