summaryrefslogtreecommitdiff
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
commit2b13c2434b763f8aeb93c17189da7b2d94fecb4c (patch)
tree6d7c99a614fa7dd212b707b4e84b02fae00b6b76 /test/if.go
parent13ae3f4378b00e0b3b35ee000a5400ee74b4732f (diff)
downloadgo-2b13c2434b763f8aeb93c17189da7b2d94fecb4c.tar.gz
go: require { } around else block
R=gri, ken, r CC=golang-dev http://codereview.appspot.com/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 c1bb69d27..18a6715d7 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")
}