diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/bufiolib.go | 70 | ||||
-rw-r--r-- | test/bugs/bug102.go | 2 | ||||
-rw-r--r-- | test/bugs/bug111.go | 2 | ||||
-rw-r--r-- | test/chan/powser1.go | 8 | ||||
-rw-r--r-- | test/chan/sieve.go | 4 | ||||
-rw-r--r-- | test/dialgoogle.go | 10 | ||||
-rw-r--r-- | test/fixedbugs/bug055.go | 12 | ||||
-rw-r--r-- | test/fixedbugs/bug067.go | 2 | ||||
-rw-r--r-- | test/ken/chan.go | 2 | ||||
-rw-r--r-- | test/ken/rob2.go | 2 | ||||
-rw-r--r-- | test/method.go | 2 | ||||
-rw-r--r-- | test/readfile.go | 4 | ||||
-rw-r--r-- | test/sieve.go | 2 | ||||
-rw-r--r-- | test/tcpserver.go | 2 | ||||
-rw-r--r-- | test/timelib.go | 4 |
15 files changed, 64 insertions, 64 deletions
diff --git a/test/bufiolib.go b/test/bufiolib.go index a3c05036f..d27bda655 100644 --- a/test/bufiolib.go +++ b/test/bufiolib.go @@ -22,7 +22,7 @@ func StringToBytes(s string) *[]byte { return b } -// Should be in language! +// Should be in language! func Copy(p *[]byte, q *[]byte) { for i := 0; i < len(p); i++ { p[i] = q[i] @@ -36,17 +36,17 @@ type ByteReader struct { func NewByteReader(p *[]byte) io.Read { b := new(ByteReader); - b.p = p + b.p = p; return b } func (b *ByteReader) Read(p *[]byte) (int, *os.Error) { - n := len(p) + n := len(p); if n > len(b.p) { n = len(b.p) } Copy(p[0:n], b.p[0:n]); - b.p = b.p[n:len(b.p)] + b.p = b.p[n:len(b.p)]; return n, nil } @@ -58,12 +58,12 @@ type HalfByteReader struct { func NewHalfByteReader(p *[]byte) io.Read { b := new(HalfByteReader); - b.p = p + b.p = p; return b } func (b *HalfByteReader) Read(p *[]byte) (int, *os.Error) { - n := len(p)/2 + n := len(p)/2; if n == 0 && len(p) > 0 { n = 1 } @@ -71,7 +71,7 @@ func (b *HalfByteReader) Read(p *[]byte) (int, *os.Error) { n = len(b.p) } Copy(p[0:n], b.p[0:n]); - b.p = b.p[n:len(b.p)] + b.p = b.p[n:len(b.p)]; return n, nil } @@ -82,12 +82,12 @@ type Rot13Reader struct { func NewRot13Reader(r io.Read) *Rot13Reader { r13 := new(Rot13Reader); - r13.r = r + r13.r = r; return r13 } func (r13 *Rot13Reader) Read(p *[]byte) (int, *os.Error) { - n, e := r13.r.Read(p) + n, e := r13.r.Read(p); if e != nil { return n, e } @@ -100,7 +100,7 @@ func (r13 *Rot13Reader) Read(p *[]byte) (int, *os.Error) { } } } - return n, nil + return n, nil } func MakeByteReader(p *[]byte) io.Read { @@ -119,9 +119,9 @@ var readmakers = []*(p *[]byte) io.Read { // Call ReadLineString (which ends up calling everything else) // to accumulate the text of a file. func ReadLines(b *bufio.BufRead) string { - s := "" + s := ""; for { - s1, e := b.ReadLineString('\n', true) + s1, e := b.ReadLineString('\n', true); if e == bufio.EndOfFile { break } @@ -136,9 +136,9 @@ func ReadLines(b *bufio.BufRead) string { // Call ReadByte to accumulate the text of a file func ReadBytes(buf *bufio.BufRead) string { var b [1000]byte; - nb := 0 + nb := 0; for { - c, e := buf.ReadByte() + c, e := buf.ReadByte(); if e == bufio.EndOfFile { break } @@ -146,7 +146,7 @@ func ReadBytes(buf *bufio.BufRead) string { panic("GetBytes: "+e.String()) } b[nb] = c; - nb++ + nb++; } // BUG return string(b[0:nb]) ? return string(b)[0:nb] @@ -155,11 +155,11 @@ func ReadBytes(buf *bufio.BufRead) string { // Call Read to accumulate the text of a file func Reads(buf *bufio.BufRead, m int) string { var b [1000]byte; - nb := 0 + nb := 0; for { // BUG parens around (&b) should not be needed n, e := buf.Read((&b)[nb:nb+m]); - nb += n + nb += n; if e == bufio.EndOfFile { break } @@ -190,7 +190,7 @@ func TestBufRead() { // work around 6g bug101 readmakers[0] = &NewByteReader; readmakers[1] = &NewHalfByteReader; - + bufreaders[0] = &Read1; bufreaders[1] = &Read2; bufreaders[2] = &Read3; @@ -199,7 +199,7 @@ func TestBufRead() { bufreaders[5] = &Read7; bufreaders[6] = &ReadBytes; bufreaders[7] = &ReadLines; - + bufsizes[0] = 1; bufsizes[1] = 2; bufsizes[2] = 3; @@ -218,17 +218,17 @@ func TestBufRead() { bufsizes[15] = 128; bufsizes[16] = 1024; bufsizes[17] = 4096; - - var texts [31]string + + var texts [31]string; str := ""; - all := "" + all := ""; for i := 0; i < len(texts)-1; i++ { texts[i] = str + "\n"; all += texts[i]; str += string(i%26+'a') } texts[len(texts)-1] = all; - + // BUG 6g should not need nbr temporary (bug099) nbr := NewByteReader(StringToBytes("hello world")); b, e := bufio.NewBufRead(nbr); @@ -242,11 +242,11 @@ func TestBufRead() { for h := 0; h < len(texts); h++ { text := texts[h]; - textbytes := StringToBytes(text) + textbytes := StringToBytes(text); for i := 0; i < len(readmakers); i++ { - readmaker := readmakers[i] + readmaker := readmakers[i]; for j := 0; j < len(bufreaders); j++ { - bufreader := bufreaders[j] + bufreader := bufreaders[j]; for k := 0; k < len(bufsizes); k++ { bufsize := bufsizes[k]; read := readmaker(textbytes); @@ -288,7 +288,7 @@ func (w *ByteWriter) Write(p *[]byte) (int, *os.Error) { w.p = newp } Copy(w.p[w.n:w.n+len(p)], p); - w.n += len(p) + w.n += len(p); return len(p), nil } @@ -296,7 +296,7 @@ func (w *ByteWriter) GetBytes() *[]byte { return w.p[0:w.n] } -// Accumulates bytes written into a byte array +// Accumulates bytes written into a byte array // but Write only takes half of what you give it. type HalfByteWriter struct { bw WriteBuffer @@ -304,14 +304,14 @@ type HalfByteWriter struct { func NewHalfByteWriter() WriteBuffer { w := new(HalfByteWriter); - w.bw = NewByteWriter() + w.bw = NewByteWriter(); return w } func (w *HalfByteWriter) Write(p *[]byte) (int, *os.Error) { n := (len(p)+1) / 2; // BUG return w.bw.Write(p[0:n]) - r, e := w.bw.Write(p[0:n]) + r, e := w.bw.Write(p[0:n]); return r, e } @@ -320,7 +320,7 @@ func (w *HalfByteWriter) GetBytes() *[]byte { } func TestBufWrite() { - var data [8192]byte + var data [8192]byte; var writers [2]*()WriteBuffer; writers[0] = &NewByteWriter; @@ -334,7 +334,7 @@ func TestBufWrite() { for k := 0; k < len(writers); k++ { nwrite := bufsizes[i]; bs := bufsizes[j]; - + // Write nwrite bytes using buffer size bs. // Check that the right amount makes it out // and that the data is correct. @@ -344,18 +344,18 @@ func TestBufWrite() { if e != nil { panic("NewBufWriteSize error: "+e.String()) } - n, e1 := buf.Write((&data)[0:nwrite]) + n, e1 := buf.Write((&data)[0:nwrite]); if e1 != nil { panic("buf.Write error "+e1.String()) } if n != nwrite { panic("buf.Write wrong count") } - e = buf.Flush() + e = buf.Flush(); if e != nil { panic("buf.Flush error "+e.String()) } - + written := write.GetBytes(); if len(written) != nwrite { panic("wrong amount written") diff --git a/test/bugs/bug102.go b/test/bugs/bug102.go index 6ce4329fb..314a37f3d 100644 --- a/test/bugs/bug102.go +++ b/test/bugs/bug102.go @@ -16,7 +16,7 @@ func main() { if string(b1) != "hello" { panic("bad convert 1") } - var b2 = new([]byte, 5) + var b2 = new([]byte, 5); for i := 0; i < 5; i++ { b2[i] = b1[i] } if string(b2) != "hello" { panic("bad convert 2") diff --git a/test/bugs/bug111.go b/test/bugs/bug111.go index e49357aa9..39da9b4dd 100644 --- a/test/bugs/bug111.go +++ b/test/bugs/bug111.go @@ -17,7 +17,7 @@ export type Stucky struct { } func (s *Stucky) Me() Iffy { - ncall++ + ncall++; return s } diff --git a/test/chan/powser1.go b/test/chan/powser1.go index 193bab1bd..4b0aa6128 100644 --- a/test/chan/powser1.go +++ b/test/chan/powser1.go @@ -137,7 +137,7 @@ func getn(in *[]*dch, n int) *[]item { dat[i] = nil; } for n=2*n; n>0; n-- { - seqno++ + seqno++; select{ case req[0] <- seqno: @@ -337,7 +337,7 @@ func Add(U, V PS) PS{ copy(V,Z); case 2: Z.dat <- uv[0]; - copy(U,Z) + copy(U,Z); case 3: Z.dat <- finis; } @@ -612,7 +612,7 @@ func Init() { func check(U PS, c item, count int, str string) { for i := 0; i < count; i++ { - r := get(U) + r := get(U); if !r.eq(c) { print("got: "); r.pr(); @@ -665,7 +665,7 @@ func main() { checka(in, a, "Integ"); // 0 1 1/2 1/3 1/4 1/5 check(Cmul(neg(one), Twos), itor(-2), 10, "CMul"); // -1 -1 -1 -1 -1 check(Sub(Ones, Twos), itor(-1), 0, "Sub Ones Twos"); // -1 -1 -1 -1 -1 - m := Mul(Ones, Ones) + m := Mul(Ones, Ones); // BUG: want array initializer for i:=0; i < N; i++ { a[i] = itor(int64(i+1)) diff --git a/test/chan/sieve.go b/test/chan/sieve.go index 0b596a874..f45373b48 100644 --- a/test/chan/sieve.go +++ b/test/chan/sieve.go @@ -20,7 +20,7 @@ func Generate(ch *chan<- int) { // removing those divisible by 'prime'. func Filter(in *<-chan int, out *chan<- int, prime int) { for { - i := <-in // Receive value of new variable 'i' from 'in'. + i := <-in; // Receive value of new variable 'i' from 'in'. if i % prime != 0 { out <- i // Send 'i' to channel 'out'. } @@ -43,7 +43,7 @@ func Sieve(primes *chan<- int) { func main() { primes := new(chan int); go Sieve(primes); - a := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97} + a := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}; for i := 0; i < len(a); i++ { if <-primes != a[i] { panic(a[i])} } diff --git a/test/dialgoogle.go b/test/dialgoogle.go index 58dc0af53..ca2c35cce 100644 --- a/test/dialgoogle.go +++ b/test/dialgoogle.go @@ -59,7 +59,7 @@ func FetchGoogle(fd net.Conn) { } func TestDial(network, addr string) { - fd, err := net.Dial(network, "", addr) + fd, err := net.Dial(network, "", addr); if err != nil { panic("net.Dial ", network, " ", addr, ": ", err.String()) } @@ -67,7 +67,7 @@ func TestDial(network, addr string) { } func TestDialTCP(network, addr string) { - fd, err := net.DialTCP(network, "", addr) + fd, err := net.DialTCP(network, "", addr); if err != nil { panic("net.DialTCP ", network, " ", addr, ": ", err.String()) } @@ -87,20 +87,20 @@ var addrs = []string { func main() { - flag.Parse() + flag.Parse(); // If no ipv6 tunnel, don't try the last address. if !ipv6 { addrs[len(addrs)-1] = "" } for i := 0; i < len(addrs); i++ { - addr := addrs[i] + addr := addrs[i]; if addr == "" { continue } // print(addr, "\n"); TestDial("tcp", addr); - TestDialTCP("tcp", addr) + TestDialTCP("tcp", addr); if addr[0] != '[' { TestDial("tcp4", addr); TestDialTCP("tcp4", addr) diff --git a/test/fixedbugs/bug055.go b/test/fixedbugs/bug055.go index cf9dcd7c8..a8b1a6cd2 100644 --- a/test/fixedbugs/bug055.go +++ b/test/fixedbugs/bug055.go @@ -7,15 +7,15 @@ package main func main() { - var i int - var j int + var i int; + var j int; if true {} { return } - i = 0 - if true {} else i++ + i = 0; + if true {} else i++; type s struct {}; - i = 0 - type s2 int + i = 0; + type s2 int; var k = func (a int) int { return a+1 }(3); ro: } diff --git a/test/fixedbugs/bug067.go b/test/fixedbugs/bug067.go index 451ebbbf3..fd22cd6f8 100644 --- a/test/fixedbugs/bug067.go +++ b/test/fixedbugs/bug067.go @@ -9,7 +9,7 @@ package main var c *chan int func main() { - c = new(chan int) + c = new(chan int); go func() { print("ok\n"); c <- 0 } (); <-c } diff --git a/test/ken/chan.go b/test/ken/chan.go index 8913528a8..73f4a8bb1 100644 --- a/test/ken/chan.go +++ b/test/ken/chan.go @@ -65,7 +65,7 @@ send() bool tots++; c.sv = expect(c.sv, c.sv); if c.sv == End { - c.sc = nil + c.sc = nil; return true; } return false; diff --git a/test/ken/rob2.go b/test/ken/rob2.go index f7bec7bb7..cca74e57a 100644 --- a/test/ken/rob2.go +++ b/test/ken/rob2.go @@ -134,7 +134,7 @@ func Get() int peekc = -1; } else { c = convert(int, input[inputindex]); - inputindex++ + inputindex++; if c == '\n' { lineno = lineno + 1; } diff --git a/test/method.go b/test/method.go index 7d4122d00..dcbc28c1e 100644 --- a/test/method.go +++ b/test/method.go @@ -40,7 +40,7 @@ func main() { var p P; var pp *P1; var t T; - var pt *T1 + var pt *T1; if s.val() != 1 { panicln("s.val:", s.val()) } if ps.val() != 2 { panicln("ps.val:", ps.val()) } diff --git a/test/readfile.go b/test/readfile.go index c9cf11a2d..db8ca99e4 100644 --- a/test/readfile.go +++ b/test/readfile.go @@ -8,8 +8,8 @@ package main func main() { - var s string - var ok bool + var s string; + var ok bool; s, ok = sys.readfile("readfile.go"); if !ok { diff --git a/test/sieve.go b/test/sieve.go index 998c4be66..366d5b94c 100644 --- a/test/sieve.go +++ b/test/sieve.go @@ -17,7 +17,7 @@ func Generate(ch *chan<- int) { // removing those divisible by 'prime'. func Filter(in *<-chan int, out *chan<- int, prime int) { for { - i := <-in // Receive value of new variable 'i' from 'in'. + i := <-in; // Receive value of new variable 'i' from 'in'. if i % prime != 0 { out <- i // Send 'i' to channel 'out'. } diff --git a/test/tcpserver.go b/test/tcpserver.go index b4de50502..2ad2d8d88 100644 --- a/test/tcpserver.go +++ b/test/tcpserver.go @@ -48,7 +48,7 @@ func Serve(network, addr string, listening, done *chan<- int) { if err != nil { break; } - echodone := new(chan int) + echodone := new(chan int); go Echo(fd, echodone); <-echodone; // make sure Echo stops l.Close(); diff --git a/test/timelib.go b/test/timelib.go index 5a27ddf42..aeb44b1a5 100644 --- a/test/timelib.go +++ b/test/timelib.go @@ -57,7 +57,7 @@ func main() { sec := UTCTests[i].seconds; golden := &UTCTests[i].golden; t := time.SecondsToUTC(sec); - newsec := t.Seconds() + newsec := t.Seconds(); if newsec != sec { panic("SecondsToUTC and back ", sec, " ", newsec) } @@ -72,7 +72,7 @@ func main() { sec := LocalTests[i].seconds; golden := &LocalTests[i].golden; t := time.SecondsToLocalTime(sec); - newsec := t.Seconds() + newsec := t.Seconds(); if newsec != sec { panic("SecondsToLocalTime and back ", sec, " ", newsec) } |