diff options
Diffstat (limited to 'src/cmd/compile/internal/test/testdata/ctl_test.go')
| -rw-r--r-- | src/cmd/compile/internal/test/testdata/ctl_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/test/testdata/ctl_test.go b/src/cmd/compile/internal/test/testdata/ctl_test.go index 501f79eee1..608bdcf6b9 100644 --- a/src/cmd/compile/internal/test/testdata/ctl_test.go +++ b/src/cmd/compile/internal/test/testdata/ctl_test.go @@ -72,6 +72,22 @@ func switch_ssa(a int) int { return ret } +func switch_nonconstcase(n, c int) int { + switch n { + case 1: + return 1 + case 2: + return 2 + case c: + return 9 + case 3: + return 3 + case 4: + return 4 + } + return 0 +} + func fallthrough_ssa(a int) int { ret := 0 switch a { @@ -107,6 +123,9 @@ func testSwitch(t *testing.T) { t.Errorf("switch_ssa(i) = %d, wanted %d", got, i) } } + if got := switch_nonconstcase(3, 3); got != 9 { + t.Errorf("switch_nonconstcase(3, 3) = %d, wanted 9", got) + } } type junk struct { |
