1
2
3
4
5
6
7
8
9
10
11
12 package main
13
14 var gen = 'a'
15
16 func f(n int) string {
17 s := string(gen) + string(n+'A'-1)
18 gen++
19 return s
20 }
21
22 func g(x, y string) string {
23 return x + y
24 }
25
26 func main() {
27 s := f(1) + f(2)
28 if s != "aAbB" {
29 println("BUG: bug221a: ", s)
30 panic("fail")
31 }
32 s = g(f(3), f(4))
33 if s != "cCdD" {
34 println("BUG: bug221b: ", s)
35 panic("fail")
36 }
37 s = f(5) + f(6) + f(7) + f(8) + f(9)
38 if s != "eEfFgGhHiI" {
39 println("BUG: bug221c: ", s)
40 panic("fail")
41 }
42 }
43
View as plain text