1 // $G $F.go && $L $F.$A && ./$A.out
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
9 func assert(cond bool, msg string) {
11 print("assertion fail: ", msg, "\n")
79 assert(false, "default")
90 assert(false, "default")
107 assert(i5 == 5, "good")
154 assert(i5 == 5, "good")
162 fallthrough // tests scoping of cases
203 assert(i5 == 5, "good")
205 assert(fired, "fired")
240 assert(i5 == count, "good")
242 assert(fired, "fired")
246 assert(false, "wowie")
248 assert(true, "hello")
250 assert(false, "jumpn")
252 assert(false, "default")
256 switch i := i5 + 2; i {
260 assert(false, "fail")
264 // switch on nil-only comparison types
265 switch f := func() {}; f {
267 assert(false, "f should not be nil")
271 switch m := make(map[int]int); m {
273 assert(false, "m should not be nil")
277 switch a := make([]int, 1); a {
279 assert(false, "m should not be nil")