summaryrefslogtreecommitdiff
path: root/test/switch.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-02-24 11:48:19 +1100
committerRob Pike <r@golang.org>2012-02-24 11:48:19 +1100
commit80a9783f842ff5d14fd5e2e5d5a129635a081031 (patch)
tree1ee1d083efadeb7077c17d701a82c5d338f4c30c /test/switch.go
parentc05c3a9d1180e6d449049d9ed96c46b65837bb29 (diff)
downloadgo-git-80a9783f842ff5d14fd5e2e5d5a129635a081031.tar.gz
test/[n-z]*.go: add documentation
R=golang-dev, bradfitz, r CC=golang-dev https://golang.org/cl/5700056
Diffstat (limited to 'test/switch.go')
-rw-r--r--test/switch.go13
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)
+ }
}