aboutsummaryrefslogtreecommitdiff
path: root/test/if.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-07-14 17:15:52 -0400
committerRuss Cox <rsc@golang.org>2011-07-14 17:15:52 -0400
commit58e19aa4cb8656cdb757172647dfcb028029185e (patch)
tree9c1936561c6f172fa7711417e6da6cbf605db38a /test/if.go
parent3f53475c977c50f8370cc916bc3ed4e0045f23dd (diff)
downloadgo-58e19aa4cb8656cdb757172647dfcb028029185e.tar.gz
go-58e19aa4cb8656cdb757172647dfcb028029185e.zip
go: require { } around else block
R=gri, ken, r CC=golang-dev https://golang.org/cl/4721044
Diffstat (limited to 'test/if.go')
-rw-r--r--test/if.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/if.go b/test/if.go
index c1bb69d277..18a6715d7e 100644
--- a/test/if.go
+++ b/test/if.go
@@ -53,25 +53,28 @@ func main() {
count = 0
if true {
count = count + 1
- } else
+ } else {
count = count - 1
+ }
assertequal(count, 1, "if else true")
count = 0
if false {
count = count + 1
- } else
+ } else {
count = count - 1
+ }
assertequal(count, -1, "if else false")
count = 0
- if t:=1; false {
+ if t := 1; false {
count = count + 1
_ = t
t := 7
_ = t
- } else
+ } else {
count = count - t
+ }
assertequal(count, -1, "if else false var")
count = 0
@@ -80,8 +83,9 @@ func main() {
count = count + 1
t := 7
_ = t
- } else
+ } else {
count = count - t
+ }
_ = t
assertequal(count, -1, "if else false var outside")
}