2012-02-16 21:50:37 -07:00
|
|
|
// run
|
2008-06-06 15:27:34 -06:00
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2012-02-23 22:24:24 -07:00
|
|
|
// Test simple switch.
|
|
|
|
|
2008-06-06 15:27:34 -06:00
|
|
|
package main
|
|
|
|
|
2012-01-18 14:20:55 -07:00
|
|
|
func main() {
|
2012-01-18 15:31:31 -07:00
|
|
|
r := ""
|
2012-01-18 14:20:55 -07:00
|
|
|
a := 3
|
|
|
|
for i := 0; i < 10; i = i + 1 {
|
|
|
|
switch i {
|
2008-06-06 15:27:34 -06:00
|
|
|
case 5:
|
2012-01-18 15:31:31 -07:00
|
|
|
r += "five"
|
2012-01-18 14:20:55 -07:00
|
|
|
case a, 7:
|
2012-01-18 15:31:31 -07:00
|
|
|
r += "a"
|
2008-06-06 15:27:34 -06:00
|
|
|
default:
|
2012-01-18 15:31:31 -07:00
|
|
|
r += string(i + '0')
|
2008-06-06 15:27:34 -06:00
|
|
|
}
|
2012-01-18 15:31:31 -07:00
|
|
|
r += "out" + string(i+'0')
|
|
|
|
}
|
|
|
|
if r != "0out01out12out2aout34out4fiveout56out6aout78out89out9" {
|
|
|
|
panic(r)
|
2008-06-06 15:27:34 -06:00
|
|
|
}
|
|
|
|
}
|