diff options
author | Rob Pike <r@golang.org> | 2008-10-17 11:48:51 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2008-10-17 11:48:51 -0700 |
commit | 889a8c5946295a236331c9ab83d157842d8a91a0 (patch) | |
tree | 5f70875cc2b6e36efa2fd59777e801a15d6d10a9 /test/fixedbugs/bug090.go | |
parent | 37a81c87ca24c802519847ea81ff4482ef5c00b3 (diff) | |
download | go-889a8c5946295a236331c9ab83d157842d8a91a0.tar.gz |
update fixed bugs (and delete an irrelevant one)
R=rsc
DELTA=328 (158 added, 170 deleted, 0 changed)
OCL=17353
CL=17359
Diffstat (limited to 'test/fixedbugs/bug090.go')
-rw-r--r-- | test/fixedbugs/bug090.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/fixedbugs/bug090.go b/test/fixedbugs/bug090.go new file mode 100644 index 000000000..0654cff9d --- /dev/null +++ b/test/fixedbugs/bug090.go @@ -0,0 +1,45 @@ +// errchk $G $D/$F.go + +// 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. + +package main + +const ( + c3div2 = 3/2; + f3div2 = 3./2.; +) + +func assert(t bool, s string) { + if !t { + panic(s) + } +} + +func main() { + var i int; + var f float64; + + assert(c3div2 == 1, "3/2"); + assert(f3div2 == 1.5, "3/2"); + + i = c3div2; + assert(i == c3div2, "i == c3div2"); + + f = c3div2; + assert(f == c3div2, "f == c3div2"); + + f = f3div2; + assert(f == f3div2, "f == f3div2"); + + i = f3div2; // BUG: probably shouldn't compile + assert(i == c3div2, "i == c3div2 from f3div2"); + assert(i != f3div2, "i != f3div2"); // BUG: certainly shouldn't fail + + const g float64 = 1.0; + i = g; // BUG: shouldn't compile + + const h float64 = 3.14; + i = h; // BUG: certainly shouldn't compile +} |