single argument panic
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.
stop on error in doc/progs/run
R=r
CC=golang-dev
https://golang.org/cl/850041
diff --git a/test/fixedbugs/bug082.go b/test/fixedbugs/bug082.go
index 12a2da0..8353ec20 100644
--- a/test/fixedbugs/bug082.go
+++ b/test/fixedbugs/bug082.go
@@ -4,15 +4,18 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package main
-
+package main
+
func main() {
- x := 0;
- x = ^x; // unary ^ not yet implemented
- if x != ^0 { panic(x, " ", ^0) }
+ x := 0
+ x = ^x // unary ^ not yet implemented
+ if x != ^0 {
+ println(x, " ", ^0)
+ panic("fail")
+ }
}
/*
-uetli:~/Source/go/test/bugs gri$ 6g bug082.go
+uetli:~/Source/go/test/bugs gri$ 6g bug082.go
bug082.go:7: fatal error: optoas: no entry COM-<int32>INT32
*/
diff --git a/test/fixedbugs/bug084.go b/test/fixedbugs/bug084.go
index 7556f8d..c1054e5 100644
--- a/test/fixedbugs/bug084.go
+++ b/test/fixedbugs/bug084.go
@@ -7,18 +7,21 @@
package main
type Service struct {
- rpc [2]int;
+ rpc [2]int
}
func (s *Service) Serve(a int64) {
- if a != 1234 { panic(a, " not 1234\n") }
+ if a != 1234 {
+ print(a, " not 1234\n")
+ panic("fail")
+ }
}
var arith Service
func main() {
- c := make(chan string);
- a := new(Service);
- go a.Serve(1234);
- _ = c;
+ c := make(chan string)
+ a := new(Service)
+ go a.Serve(1234)
+ _ = c
}
diff --git a/test/fixedbugs/bug097.go b/test/fixedbugs/bug097.go
index d5e4099..ec3c215 100644
--- a/test/fixedbugs/bug097.go
+++ b/test/fixedbugs/bug097.go
@@ -6,16 +6,22 @@
package main
-type A []int;
+type A []int
func main() {
- var a [3]A;
+ var a [3]A
for i := 0; i < 3; i++ {
- a[i] = A{i};
+ a[i] = A{i}
}
- if a[0][0] != 0 { panic(); }
- if a[1][0] != 1 { panic(); }
- if a[2][0] != 2 { panic(); }
+ if a[0][0] != 0 {
+ panic("fail a[0][0]")
+ }
+ if a[1][0] != 1 {
+ panic("fail a[1][0]")
+ }
+ if a[2][0] != 2 {
+ panic("fail a[2][0]")
+ }
}
/*
@@ -41,7 +47,7 @@
*/
/* An array composite literal needs to be created freshly every time.
- It is a "construction" of an array after all. If I pass the address
- of the array to some function, it may store it globally. Same applies
- to struct literals.
+It is a "construction" of an array after all. If I pass the address
+of the array to some function, it may store it globally. Same applies
+to struct literals.
*/
diff --git a/test/fixedbugs/bug110.go b/test/fixedbugs/bug110.go
index b5e5875..4e43d1c 100644
--- a/test/fixedbugs/bug110.go
+++ b/test/fixedbugs/bug110.go
@@ -14,6 +14,7 @@
func main() {
if a != 0 {
- panic("a=", a)
+ println("a=", a)
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug117.go b/test/fixedbugs/bug117.go
index 2cb6d6c..ad89ebf 100644
--- a/test/fixedbugs/bug117.go
+++ b/test/fixedbugs/bug117.go
@@ -5,8 +5,12 @@
// license that can be found in the LICENSE file.
package main
-type S struct { a int }
+
+type S struct {
+ a int
+}
type PS *S
+
func (p *S) get() int {
return p.a
}
@@ -15,11 +19,11 @@
// p has type PS, and PS has no methods.
// (a compiler might see that p is a pointer
// and go looking in S without noticing PS.)
- return p.get() // ERROR "undefined"
+ return p.get() // ERROR "undefined"
}
func main() {
- s := S{1};
+ s := S{1}
if s.get() != 1 {
- panic()
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug168.go b/test/fixedbugs/bug168.go
index 221eb55..e25eb56 100644
--- a/test/fixedbugs/bug168.go
+++ b/test/fixedbugs/bug168.go
@@ -6,13 +6,14 @@
package main
-var g byte = 123;
-var f *byte = &g;
-var b = make([]byte, 5);
+var g byte = 123
+var f *byte = &g
+var b = make([]byte, 5)
func main() {
- b[0:1][0] = *f;
+ b[0:1][0] = *f
if b[0] != 123 {
- panic("want 123 got ", b[0]);
- }
+ println("want 123 got", b[0])
+ panic("fail")
+ }
}
diff --git a/test/fixedbugs/bug194.go b/test/fixedbugs/bug194.go
index 42d0631..dcd633d 100644
--- a/test/fixedbugs/bug194.go
+++ b/test/fixedbugs/bug194.go
@@ -8,25 +8,28 @@
var v1 = T1(1)
var v2 = T2{2}
-var v3 = T3{0:3, 1:4}
-var v4 = T4{0:5, 1:6}
-var v5 = T5{0:7, 1:8}
-var v6 = T2{f:9}
-var v7 = T4{f:10}
-var v8 = T5{f:11}
+var v3 = T3{0: 3, 1: 4}
+var v4 = T4{0: 5, 1: 6}
+var v5 = T5{0: 7, 1: 8}
+var v6 = T2{f: 9}
+var v7 = T4{f: 10}
+var v8 = T5{f: 11}
var pf func(T1)
func main() {
if v1 != 1 || v2.f != 2 || v3[0] != 3 || v3[1] != 4 ||
- v4[0] != 5 || v4[1] != 6 || v5[0] != 7 || v5[1] != 8 ||
- v6.f != 9 || v7[0] != 10 || v8[0] != 11 {
- panic()
+ v4[0] != 5 || v4[1] != 6 || v5[0] != 7 || v5[1] != 8 ||
+ v6.f != 9 || v7[0] != 10 || v8[0] != 11 {
+ panic("fail")
}
}
type T1 int
-type T2 struct { f int }
+type T2 struct {
+ f int
+}
type T3 []int
type T4 [2]int
-type T5 map[int] int
+type T5 map[int]int
+
const f = 0
diff --git a/test/fixedbugs/bug221.go b/test/fixedbugs/bug221.go
index 39255d6..b645831 100644
--- a/test/fixedbugs/bug221.go
+++ b/test/fixedbugs/bug221.go
@@ -12,10 +12,11 @@
package main
var gen = 'a'
+
func f(n int) string {
- s := string(gen) + string(n+'A'-1);
- gen++;
- return s;
+ s := string(gen) + string(n+'A'-1)
+ gen++
+ return s
}
func g(x, y string) string {
@@ -23,16 +24,19 @@
}
func main() {
- s := f(1) + f(2);
+ s := f(1) + f(2)
if s != "aAbB" {
- panic("BUG: bug221a: ", s);
+ println("BUG: bug221a: ", s)
+ panic("fail")
}
- s = g(f(3), f(4));
+ s = g(f(3), f(4))
if s != "cCdD" {
- panic("BUG: bug221b: ", s);
+ println("BUG: bug221b: ", s)
+ panic("fail")
}
- s = f(5) + f(6) + f(7) + f(8) + f(9);
+ s = f(5) + f(6) + f(7) + f(8) + f(9)
if s != "eEfFgGhHiI" {
- panic("BUG: bug221c: ", s);
+ println("BUG: bug221c: ", s)
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug227.go b/test/fixedbugs/bug227.go
index be27a68..a608660 100644
--- a/test/fixedbugs/bug227.go
+++ b/test/fixedbugs/bug227.go
@@ -7,11 +7,11 @@
package main
var (
- nf int
+ nf int
x, y, z = f(), f(), f()
- m = map[string]string{"a":"A"}
- a, aok = m["a"]
- b, bok = m["b"]
+ m = map[string]string{"a": "A"}
+ a, aok = m["a"]
+ b, bok = m["b"]
)
func look(s string) (string, bool) {
@@ -26,9 +26,11 @@
func main() {
if nf != 3 || x != 1 || y != 2 || z != 3 {
- panic("nf=", nf, " x=", x, " y=", y)
+ println("nf=", nf, " x=", x, " y=", y)
+ panic("fail")
}
if a != "A" || aok != true || b != "" || bok != false {
- panic("a=", a, " aok=", aok, " b=", b, " bok=", bok)
+ println("a=", a, " aok=", aok, " b=", b, " bok=", bok)
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug234.go b/test/fixedbugs/bug234.go
index 882bc74..b806ca6 100644
--- a/test/fixedbugs/bug234.go
+++ b/test/fixedbugs/bug234.go
@@ -11,10 +11,12 @@
c <- 100
x, ok := <-c
if x != 100 || !ok {
- panic("x=", x, " ok=", ok, " want 100, true")
+ println("x=", x, " ok=", ok, " want 100, true")
+ panic("fail")
}
x, ok = <-c
if x != 0 || ok {
- panic("x=", x, " ok=", ok, " want 0, false")
+ println("x=", x, " ok=", ok, " want 0, false")
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug244.go b/test/fixedbugs/bug244.go
index 26db787..915c3fc 100644
--- a/test/fixedbugs/bug244.go
+++ b/test/fixedbugs/bug244.go
@@ -25,6 +25,7 @@
func main() {
if x != 1 || y != 2 || z != 3 || nf != 1 || v != 0 || ok != false || ng != 1 {
- panic("x=", x, " y=", y, " z=", z, " nf=", nf, " v=", v, " ok=", ok, " ng=", ng)
+ println("x=", x, " y=", y, " z=", z, " nf=", nf, " v=", v, " ok=", ok, " ng=", ng)
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug253.go b/test/fixedbugs/bug253.go
index f359961..bb5b770 100644
--- a/test/fixedbugs/bug253.go
+++ b/test/fixedbugs/bug253.go
@@ -20,9 +20,10 @@
S3
S1
}
+
func main() {
var s4 S4
- if s4.i != 0 { // .i refers to s4.S1.i, unambiguously
- panic()
+ if s4.i != 0 { // .i refers to s4.S1.i, unambiguously
+ panic("fail")
}
}
diff --git a/test/fixedbugs/bug262.go b/test/fixedbugs/bug262.go
index 1ace12e..66f580b 100644
--- a/test/fixedbugs/bug262.go
+++ b/test/fixedbugs/bug262.go
@@ -40,13 +40,15 @@
m := make(map[string]int)
m[f()], *g() = strconv.Atoi(h())
if m["abc"] != 123 || trace != "fgh" {
- panic("BUG", m["abc"], trace)
+ println("BUG", m["abc"], trace)
+ panic("fail")
}
mm := make(map[string]os.Error)
trace = ""
mm["abc"] = os.EINVAL
*i(), mm[f()] = strconv.Atoi(h())
if mm["abc"] != nil || trace != "ifh" {
- panic("BUG1", mm["abc"], trace)
+ println("BUG1", mm["abc"], trace)
+ panic("fail")
}
}