summaryrefslogtreecommitdiff
path: root/test/fixedbugs
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
committerOndřej Surý <ondrej@sury.org>2011-08-03 16:54:30 +0200
commit28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch)
tree32944e18b23f7fe4a0818a694aa2a6dfb1835463 /test/fixedbugs
parente836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff)
downloadgolang-28592ee1ea1f5cdffcf85472f9de0285d928cf12.tar.gz
Imported Upstream version 59upstream/59
Diffstat (limited to 'test/fixedbugs')
-rw-r--r--test/fixedbugs/bug140.go4
-rw-r--r--test/fixedbugs/bug178.go12
-rw-r--r--test/fixedbugs/bug238.go1
-rw-r--r--test/fixedbugs/bug243.go3
-rw-r--r--test/fixedbugs/bug274.go2
-rw-r--r--test/fixedbugs/bug344.go6
-rw-r--r--test/fixedbugs/bug345.dir/io.go15
-rw-r--r--test/fixedbugs/bug345.dir/main.go28
-rw-r--r--test/fixedbugs/bug345.go7
-rw-r--r--test/fixedbugs/bug346.go19
10 files changed, 83 insertions, 14 deletions
diff --git a/test/fixedbugs/bug140.go b/test/fixedbugs/bug140.go
index e27b370e7..441c57a48 100644
--- a/test/fixedbugs/bug140.go
+++ b/test/fixedbugs/bug140.go
@@ -10,14 +10,14 @@ func main() {
if true {
} else {
L1:
+ goto L1
}
if true {
} else {
+ goto L2
L2:
main()
}
- goto L1
- goto L2
}
/*
diff --git a/test/fixedbugs/bug178.go b/test/fixedbugs/bug178.go
index 205961024..a7ff09dae 100644
--- a/test/fixedbugs/bug178.go
+++ b/test/fixedbugs/bug178.go
@@ -14,6 +14,9 @@ L:
break L
}
panic("BUG: not reached - break")
+ if false {
+ goto L1
+ }
}
L2:
@@ -23,11 +26,8 @@ L2:
continue L2
}
panic("BUG: not reached - continue")
- }
- if false {
- goto L1
- }
- if false {
- goto L3
+ if false {
+ goto L3
+ }
}
}
diff --git a/test/fixedbugs/bug238.go b/test/fixedbugs/bug238.go
index 7e8660d37..4d5a905f0 100644
--- a/test/fixedbugs/bug238.go
+++ b/test/fixedbugs/bug238.go
@@ -19,4 +19,3 @@ const h bool = false
const i int = 2
const j float64 = 5
-func main() { println(a, b, c, d, e, f, g) }
diff --git a/test/fixedbugs/bug243.go b/test/fixedbugs/bug243.go
index 0c531968e..95514cfd6 100644
--- a/test/fixedbugs/bug243.go
+++ b/test/fixedbugs/bug243.go
@@ -38,7 +38,7 @@ func Listen(x, y string) (T, string) {
}
func (t T) Addr() os.Error {
- return os.ErrorString("stringer")
+ return os.NewError("stringer")
}
func (t T) Accept() (int, string) {
@@ -49,4 +49,3 @@ func Dial(x, y, z string) (int, string) {
global <- 1
return 0, ""
}
-
diff --git a/test/fixedbugs/bug274.go b/test/fixedbugs/bug274.go
index 348aed429..81ee9e5b8 100644
--- a/test/fixedbugs/bug274.go
+++ b/test/fixedbugs/bug274.go
@@ -25,6 +25,6 @@ func main() {
L1: // ERROR "statement"
default:
// correct since no semicolon is required before a '}'
- L2: // GCCGO_ERROR "not used"
+ L2: // ERROR "not used"
}
}
diff --git a/test/fixedbugs/bug344.go b/test/fixedbugs/bug344.go
index 2a20dcf6f..d217b3bd3 100644
--- a/test/fixedbugs/bug344.go
+++ b/test/fixedbugs/bug344.go
@@ -1,4 +1,4 @@
-// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug344
+// errchk $G -e $D/$F.go
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -14,7 +14,9 @@ func main() {
i := 42
a := []*int{&i, &i, &i, &i}
x := a[0]
- goto start
+ goto start // ERROR "goto start jumps into block"
+ z := 1
+ _ = z
for _, x = range a {
start:
fmt.Sprint(*x)
diff --git a/test/fixedbugs/bug345.dir/io.go b/test/fixedbugs/bug345.dir/io.go
new file mode 100644
index 000000000..1d695c304
--- /dev/null
+++ b/test/fixedbugs/bug345.dir/io.go
@@ -0,0 +1,15 @@
+// Copyright 2011 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 io
+
+type Writer interface {
+ WrongWrite()
+}
+
+type SectionReader struct {
+ X int
+}
+
+func SR(*SectionReader) {}
diff --git a/test/fixedbugs/bug345.dir/main.go b/test/fixedbugs/bug345.dir/main.go
new file mode 100644
index 000000000..5bdc713f4
--- /dev/null
+++ b/test/fixedbugs/bug345.dir/main.go
@@ -0,0 +1,28 @@
+// Copyright 2011 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
+
+import (
+ "bufio"
+ "./io"
+ goio "io"
+)
+
+func main() {
+ // The errors here complain that io.X != io.X
+ // for different values of io so they should be
+ // showing the full import path, which for the
+ // "./io" import is really ..../go/test/io.
+ // For example:
+ //
+ // main.go:25: cannot use w (type "/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".Writer) as type "io".Writer in function argument:
+ // io.Writer does not implement io.Writer (missing Write method)
+ // main.go:27: cannot use &x (type *"io".SectionReader) as type *"/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".SectionReader in function argument
+
+ var w io.Writer
+ bufio.NewWriter(w) // ERROR "test/io"
+ var x goio.SectionReader
+ io.SR(&x) // ERROR "test/io"
+}
diff --git a/test/fixedbugs/bug345.go b/test/fixedbugs/bug345.go
new file mode 100644
index 000000000..874710ce8
--- /dev/null
+++ b/test/fixedbugs/bug345.go
@@ -0,0 +1,7 @@
+// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/main.go
+
+// Copyright 2011 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 ignored
diff --git a/test/fixedbugs/bug346.go b/test/fixedbugs/bug346.go
new file mode 100644
index 000000000..31284c31a
--- /dev/null
+++ b/test/fixedbugs/bug346.go
@@ -0,0 +1,19 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: issue2056
+
+// Copyright 2011 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
+
+import "os"
+
+func main() {
+ x := 4
+ a, b, c, d := func(i int) (p int, q int, r int, s int) { return 1, i, 3, x }(2)
+
+ if a != 1 || b != 2 || c != 3 || d != 4 {
+ println("abcd: expected 1 2 3 4 got", a, b, c, d)
+ os.Exit(1)
+ }
+}