diff options
Diffstat (limited to 'test/switch.go')
-rw-r--r-- | test/switch.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/switch.go b/test/switch.go index 68bd117f0b..09bf4341a0 100644 --- a/test/switch.go +++ b/test/switch.go @@ -4,8 +4,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Test switch statements. + package main +import "os" + func assert(cond bool, msg string) { if !cond { print("assertion fail: ", msg, "\n") @@ -279,4 +283,13 @@ func main() { assert(false, "m should not be nil") default: } + + i := 0 + switch x := 5; { + case i < x: + os.Exit(0) + case i == x: + case i > x: + os.Exit(1) + } } |