Source file
test/func8.go
1
2
3
4
5
6
7
8
9 package main
10
11 var calledf int
12
13 func f() int {
14 calledf++
15 return 0
16 }
17
18 func g() int {
19 return calledf
20 }
21
22 var xy string
23
24
25 func x() bool {
26 xy += "x"
27 return false
28 }
29
30
31 func y() string {
32 xy += "y"
33 return "abc"
34 }
35
36 func main() {
37 if f() == g() {
38 panic("wrong f,g order")
39 }
40
41 if x() == (y() == "abc") {
42 panic("wrong compare")
43 }
44 if xy != "xy" {
45 panic("wrong x,y order")
46 }
47 }
48
View as plain text