Skip to content

Commit

Permalink
test: remove semiocolons.
Browse files Browse the repository at this point in the history
The ken directory is untouched so we have some examples with explicit semis.

R=gri
CC=golang-dev
https://golang.org/cl/2157041
  • Loading branch information
robpike committed Sep 4, 2010
1 parent cd8f4cd commit 4f61fc9
Show file tree
Hide file tree
Showing 88 changed files with 2,537 additions and 2,541 deletions.
302 changes: 151 additions & 151 deletions test/64bit.go

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions test/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,45 @@ package main
import "sync"

type T struct {
int;
sync.Mutex;
int
sync.Mutex
}

func main() {
{
var x, y sync.Mutex;
x = y; // ERROR "assignment.*Mutex"
_ = x;
var x, y sync.Mutex
x = y // ERROR "assignment.*Mutex"
_ = x
}
{
var x, y T;
x = y; // ERROR "assignment.*Mutex"
_ = x;
var x, y T
x = y // ERROR "assignment.*Mutex"
_ = x
}
{
var x, y [2]sync.Mutex;
x = y; // ERROR "assignment.*Mutex"
_ = x;
var x, y [2]sync.Mutex
x = y // ERROR "assignment.*Mutex"
_ = x
}
{
var x, y [2]T;
x = y; // ERROR "assignment.*Mutex"
_ = x;
var x, y [2]T
x = y // ERROR "assignment.*Mutex"
_ = x
}
{
x := sync.Mutex{0, 0}; // ERROR "assignment.*Mutex"
_ = x;
x := sync.Mutex{0, 0} // ERROR "assignment.*Mutex"
_ = x
}
{
x := sync.Mutex{key: 0}; // ERROR "(unknown|assignment).*Mutex"
_ = x;
x := sync.Mutex{key: 0} // ERROR "(unknown|assignment).*Mutex"
_ = x
}
{
x := &sync.Mutex{}; // ok
var y sync.Mutex; // ok
y = *x; // ERROR "assignment.*Mutex"
*x = y; // ERROR "assignment.*Mutex"
_ = x;
_ = y;
x := &sync.Mutex{} // ok
var y sync.Mutex // ok
y = *x // ERROR "assignment.*Mutex"
*x = y // ERROR "assignment.*Mutex"
_ = x
_ = y
}
}
86 changes: 43 additions & 43 deletions test/bigalg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,111 +7,111 @@
package main

type T struct {
a float64;
b int64;
c string;
d byte;
a float64
b int64
c string
d byte
}

var a = []int{ 1, 2, 3 }
var NIL []int;
var NIL []int

func arraycmptest() {
if NIL != nil {
println("fail1:", NIL, "!= nil");
println("fail1:", NIL, "!= nil")
}
if nil != NIL {
println("fail2: nil !=", NIL);
println("fail2: nil !=", NIL)
}
if a == nil || nil == a {
println("fail3:", a, "== nil");
println("fail3:", a, "== nil")
}
}

func SameArray(a, b []int) bool {
if len(a) != len(b) || cap(a) != cap(b) {
return false;
return false
}
if len(a) > 0 && &a[0] != &b[0] {
return false;
return false
}
return true;
return true
}

var t = T{1.5, 123, "hello", 255}
var mt = make(map[int]T)
var ma = make(map[int][]int)

func maptest() {
mt[0] = t;
t1 := mt[0];
mt[0] = t
t1 := mt[0]
if t1.a != t.a || t1.b != t.b || t1.c != t.c || t1.d != t.d {
println("fail: map val struct", t1.a, t1.b, t1.c, t1.d);
println("fail: map val struct", t1.a, t1.b, t1.c, t1.d)
}

ma[1] = a;
a1 := ma[1];
ma[1] = a
a1 := ma[1]
if !SameArray(a, a1) {
println("fail: map val array", a, a1);
println("fail: map val array", a, a1)
}
}

var ct = make(chan T)
var ca = make(chan []int)

func send() {
ct <- t;
ca <- a;
ct <- t
ca <- a
}

func chantest() {
go send();
go send()

t1 := <-ct;
t1 := <-ct
if t1.a != t.a || t1.b != t.b || t1.c != t.c || t1.d != t.d {
println("fail: map val struct", t1.a, t1.b, t1.c, t1.d);
println("fail: map val struct", t1.a, t1.b, t1.c, t1.d)
}

a1 := <-ca;
a1 := <-ca
if !SameArray(a, a1) {
println("fail: map val array", a, a1);
println("fail: map val array", a, a1)
}
}

type E struct { }
var e E

func interfacetest() {
var i interface{};
var i interface{}

i = a;
a1 := i.([]int);
i = a
a1 := i.([]int)
if !SameArray(a, a1) {
println("interface <-> []int", a, a1);
println("interface <-> []int", a, a1)
}
pa := new([]int);
*pa = a;
i = pa;
a1 = *i.(*[]int);
pa := new([]int)
*pa = a
i = pa
a1 = *i.(*[]int)
if !SameArray(a, a1) {
println("interface <-> *[]int", a, a1);
println("interface <-> *[]int", a, a1)
}

i = t;
t1 := i.(T);
i = t
t1 := i.(T)
if t1.a != t.a || t1.b != t.b || t1.c != t.c || t1.d != t.d {
println("interface <-> struct", t1.a, t1.b, t1.c, t1.d);
println("interface <-> struct", t1.a, t1.b, t1.c, t1.d)
}

i = e;
e1 := i.(E);
i = e
e1 := i.(E)
// nothing to check; just verify it doesn't crash
_ = e1;
_ = e1
}

func main() {
arraycmptest();
maptest();
chantest();
interfacetest();
arraycmptest()
maptest()
chantest()
interfacetest()
}
60 changes: 30 additions & 30 deletions test/blank.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import _ "fmt"
var call string

type T struct {
_, _, _ int;
_, _, _ int
}

func (T) _() {
Expand All @@ -21,11 +21,11 @@ func (T) _() {
}

const (
c0 = iota;
_;
_;
_;
c4;
c0 = iota
_
_
_
c4
)

var ints = []string {
Expand All @@ -35,67 +35,67 @@ var ints = []string {
}

func f() (int, int) {
call += "f";
call += "f"
return 1,2
}

func g() (float, float) {
call += "g";
call += "g"
return 3,4
}

func h(_ int, _ float) {
}

func i() int {
call += "i";
return 23;
call += "i"
return 23
}

var _ = i();
var _ = i()

func main() {
if call != "i" {panic("init did not run")}
call = "";
_, _ = f();
a, _ := f();
call = ""
_, _ = f()
a, _ := f()
if a != 1 {panic(a)}
b, _ := g();
b, _ := g()
if b != 3 {panic(b)}
_, a = f();
_, a = f()
if a != 2 {panic(a)}
_, b = g();
_, b = g()
if b != 4 {panic(b)}
_ = i();
_ = i()
if call != "ffgfgi" {panic(call)}
if c4 != 4 {panic(c4)}

out := "";
out := ""
for _, s := range ints {
out += s;
out += s
}
if out != "123" {panic(out)}

sum := 0;
sum := 0
for s, _ := range ints {
sum += s;
sum += s
}
if sum != 3 {panic(sum)}

h(a,b);
h(a,b)
}

// useless but legal
var _ int = 1;
var _ = 2;
var _, _ = 3, 4;
const _ = 3;
const _, _ = 4, 5;
type _ int;
var _ int = 1
var _ = 2
var _, _ = 3, 4
const _ = 3
const _, _ = 4, 5
type _ int
func _() {
panic("oops")
}

func ff() {
var _ int = 1;
var _ int = 1
}
4 changes: 2 additions & 2 deletions test/blank1.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
package _ // ERROR "invalid package name _"

func main() {
_(); // ERROR "cannot use _ as value"
x := _+1; // ERROR "cannot use _ as value"
_() // ERROR "cannot use _ as value"
x := _+1 // ERROR "cannot use _ as value"
}
Loading

0 comments on commit 4f61fc9

Please sign in to comment.