aboutsummaryrefslogtreecommitdiff
path: root/test/typeswitch.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-03-17 20:57:54 -0700
committerRob Pike <r@golang.org>2009-03-17 20:57:54 -0700
commitbd3c478f935e91e05dbb17d7a4297eb89d8c8e06 (patch)
tree8f874c11c73353fb3dc7801defd5a0188dd71a50 /test/typeswitch.go
parentbcb464d221d677e62e365caad34ccb0a268f0754 (diff)
downloadgo-bd3c478f935e91e05dbb17d7a4297eb89d8c8e06.tar.gz
go-bd3c478f935e91e05dbb17d7a4297eb89d8c8e06.zip
add value checks to the other switch - should have done this in prior round
R=rsc OCL=26438 CL=26438
Diffstat (limited to 'test/typeswitch.go')
-rw-r--r--test/typeswitch.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/typeswitch.go b/test/typeswitch.go
index 3547ff101f..a28806d5ca 100644
--- a/test/typeswitch.go
+++ b/test/typeswitch.go
@@ -91,23 +91,23 @@ func main() {
for i := Bool; i < Last; i++ {
switch x := f(i).(type) {
case bool:
- assert(x == true, "switch 2 bool");
+ assert(x == true && i == Bool, "switch 2 bool");
case int:
- assert(x == 7, "switch 2 int");
+ assert(x == 7 && i == Int, "switch 2 int");
case float:
- assert(x == 7.4, "switch 2 float");
+ assert(x == 7.4 && i == Float, "switch 2 float");
case string:
- assert(x == "hello", "switch 2 string");
+ assert(x == "hello" && i == String, "switch 2 string");
case S:
- assert(x.a == 1234, "switch 2 struct");
+ assert(x.a == 1234 && i == Struct, "switch 2 struct");
case chan int:
- assert(x == c, "switch 2 chan");
+ assert(x == c && i == Chan, "switch 2 chan");
case []int:
- assert(x[3] == 3, "switch 2 array");
+ assert(x[3] == 3 && i == Array, "switch 2 array");
case map[string]int:
- assert(x == m, "switch 2 map");
+ assert(x == m && i == Map, "switch 2 map");
case func(i int) interface{}:
- assert(x == f, "switch 2 fun");
+ assert(x == f && i == Func, "switch 2 fun");
default:
assert(false, "switch 2 unknown");
}