From 38bb503bdb1595572fbb012cca1e531d6c780fb3 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 16 Jan 2009 14:58:14 -0800 Subject: casify, cleanup sys R=r OCL=22978 CL=22984 --- test/235.go | 2 +- test/args.go | 6 +++--- test/bugs/bug130.go | 2 +- test/chan/fifo.go | 2 +- test/chan/goroutines.go | 6 +++--- test/chan/nonblock.go | 2 +- test/chan/powser1.go | 4 ++-- test/chan/powser2.go | 4 ++-- test/chan/sieve.go | 2 +- test/char_lit.go | 4 ++-- test/env.go | 6 +++--- test/fixedbugs/bug006.go | 2 +- test/fixedbugs/bug059.go | 2 +- test/fixedbugs/bug060.go | 2 +- test/fixedbugs/bug097.go | 4 ++-- test/fixedbugs/bug120.go | 2 +- test/if1.go | 4 ++-- test/int_lit.go | 4 ++-- test/interface4.go | 2 +- test/interface6.go | 2 +- test/ken/chan.go | 14 +++++++------- test/readfile.go | 6 +++--- test/string_lit.go | 4 ++-- test/switch1.go | 4 ++-- test/utf.go | 8 +++++--- 25 files changed, 51 insertions(+), 49 deletions(-) (limited to 'test') diff --git a/test/235.go b/test/235.go index 9db10175d..e24106dd0 100644 --- a/test/235.go +++ b/test/235.go @@ -65,5 +65,5 @@ func main() { x = min(xs); if x != OUT[i] { panic("bad: ", x, " should be ", OUT[i]); } } - sys.exit(0); + sys.Exit(0); } diff --git a/test/args.go b/test/args.go index 0e9b9a315..4b9671a53 100644 --- a/test/args.go +++ b/test/args.go @@ -7,13 +7,13 @@ package main func main() { - if sys.argc() != 3 { + if len(sys.Args) != 3 { panic("argc") } - if sys.argv(1) != "arg1" { + if sys.Args[1] != "arg1" { panic("arg1") } - if sys.argv(2) != "arg2" { + if sys.Args[2] != "arg2" { panic("arg2") } } diff --git a/test/bugs/bug130.go b/test/bugs/bug130.go index 7122863bb..aa3f0dd70 100644 --- a/test/bugs/bug130.go +++ b/test/bugs/bug130.go @@ -16,5 +16,5 @@ func main() { var i I = &s; c := make(chan int); go i.send(c); - sys.exit(<-c); + sys.Exit(<-c); } diff --git a/test/chan/fifo.go b/test/chan/fifo.go index e19059547..ad53ab655 100644 --- a/test/chan/fifo.go +++ b/test/chan/fifo.go @@ -18,7 +18,7 @@ func AsynchFifo() { for i := 0; i < N; i++ { if <-ch != i { print("bad receive\n"); - sys.exit(1); + sys.Exit(1); } } } diff --git a/test/chan/goroutines.go b/test/chan/goroutines.go index 104b247f3..8c7f9ad69 100644 --- a/test/chan/goroutines.go +++ b/test/chan/goroutines.go @@ -20,12 +20,12 @@ func f(left, right chan int) { func main() { var n = 10000; - if sys.argc() > 1 { + if len(sys.Args) > 1 { var err *os.Error; - n, err = strconv.Atoi(sys.argv(1)); + n, err = strconv.Atoi(sys.Args[1]); if err != nil { print("bad arg\n"); - sys.exit(1); + sys.Exit(1); } } leftmost := make(chan int); diff --git a/test/chan/nonblock.go b/test/chan/nonblock.go index 1c3128d5b..36582b965 100644 --- a/test/chan/nonblock.go +++ b/test/chan/nonblock.go @@ -10,7 +10,7 @@ package main func pause() { - for i:=0; i<100; i++ { sys.gosched() } + for i:=0; i<100; i++ { sys.Gosched() } } func i32receiver(c chan int32) { diff --git a/test/chan/powser1.go b/test/chan/powser1.go index 6e6489134..3b6389169 100644 --- a/test/chan/powser1.go +++ b/test/chan/powser1.go @@ -630,7 +630,7 @@ func checka(U PS, a []*rat, str string) { func main() { Init(); - if sys.argc() > 1 { // print + if len(sys.Args) > 1 { // print print("Ones: "); Printn(Ones, 10); print("Twos: "); Printn(Twos, 10); print("Add: "); Printn(Add(Ones, Twos), 10); @@ -708,5 +708,5 @@ func main() { checka(t, a, "Tan"); // 0 1 0 1/3 0 2/15 */ } - sys.exit(0); // BUG: force waiting goroutines to exit + sys.Exit(0); // BUG: force waiting goroutines to exit } diff --git a/test/chan/powser2.go b/test/chan/powser2.go index 14364e602..094bd2bfe 100644 --- a/test/chan/powser2.go +++ b/test/chan/powser2.go @@ -635,7 +635,7 @@ func checka(U PS, a []*rat, str string) { func main() { Init(); - if sys.argc() > 1 { // print + if len(sys.Args) > 1 { // print print("Ones: "); Printn(Ones, 10); print("Twos: "); Printn(Twos, 10); print("Add: "); Printn(Add(Ones, Twos), 10); @@ -713,5 +713,5 @@ func main() { checka(t, a, "Tan"); // 0 1 0 1/3 0 2/15 */ } - sys.exit(0); // BUG: force waiting goroutines to exit + sys.Exit(0); // BUG: force waiting goroutines to exit } diff --git a/test/chan/sieve.go b/test/chan/sieve.go index 0923ab5d6..0cebdc641 100644 --- a/test/chan/sieve.go +++ b/test/chan/sieve.go @@ -47,5 +47,5 @@ func main() { for i := 0; i < len(a); i++ { if <-primes != a[i] { panic(a[i])} } - sys.exit(0); + sys.Exit(0); } diff --git a/test/char_lit.go b/test/char_lit.go index de967883b..d45ecf398 100644 --- a/test/char_lit.go +++ b/test/char_lit.go @@ -33,10 +33,10 @@ func main() { ; if '\Ucafebabe' != 0xcafebabe { print("cafebabe wrong\n"); - sys.exit(1) + sys.Exit(1) } if i != 0xcc238de1 { print("number is ", i, " should be ", 0xcc238de1, "\n"); - sys.exit(1) + sys.Exit(1) } } diff --git a/test/env.go b/test/env.go index 8b995f5b7..41f230d1a 100644 --- a/test/env.go +++ b/test/env.go @@ -12,15 +12,15 @@ func main() { ga, e0 := os.Getenv("GOARCH"); if e0 != nil { print("$GOARCH: ", e0.String(), "\n"); - sys.exit(1); + sys.Exit(1); } if ga != "amd64" { print("$GOARCH=", ga, "\n"); - sys.exit(1); + sys.Exit(1); } xxx, e1 := os.Getenv("DOES_NOT_EXIST"); if e1 != os.ENOENV { print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n"); - sys.exit(1); + sys.Exit(1); } } diff --git a/test/fixedbugs/bug006.go b/test/fixedbugs/bug006.go index 938a216e2..2fbde9c9a 100644 --- a/test/fixedbugs/bug006.go +++ b/test/fixedbugs/bug006.go @@ -13,5 +13,5 @@ const ( func main() { if g == 0.0 { print("zero\n");} - if g != 4.5 { print(" fail\n"); sys.exit(1); } + if g != 4.5 { print(" fail\n"); sys.Exit(1); } } diff --git a/test/fixedbugs/bug059.go b/test/fixedbugs/bug059.go index 501616b3d..21c078361 100644 --- a/test/fixedbugs/bug059.go +++ b/test/fixedbugs/bug059.go @@ -29,6 +29,6 @@ func main() { a[0] = "x"; m["0"][0] = "deleted"; if m["0"][0] != "deleted" { - sys.exit(1); + sys.Exit(1); } } diff --git a/test/fixedbugs/bug060.go b/test/fixedbugs/bug060.go index 124e401ff..5d5fc4a7b 100644 --- a/test/fixedbugs/bug060.go +++ b/test/fixedbugs/bug060.go @@ -12,6 +12,6 @@ func main() { m[0]++; if m[0] != 1 { print("map does not increment\n"); - sys.exit(1) + sys.Exit(1) } } diff --git a/test/fixedbugs/bug097.go b/test/fixedbugs/bug097.go index fe5fd4b87..70bd6e2b4 100644 --- a/test/fixedbugs/bug097.go +++ b/test/fixedbugs/bug097.go @@ -30,8 +30,8 @@ Faulting address: 0x4558 pc: 0x4558 0x4558?zi - sys·breakpoint(40960, 0, 45128, ...) - sys·breakpoint(0xa000, 0xb048, 0xa000, ...) + sys·Breakpoint(40960, 0, 45128, ...) + sys·Breakpoint(0xa000, 0xb048, 0xa000, ...) 0x156a?zi sys·panicl(342, 0, 0, ...) sys·panicl(0x156, 0x300000000, 0xb024, ...) diff --git a/test/fixedbugs/bug120.go b/test/fixedbugs/bug120.go index 28c435925..10e28034d 100644 --- a/test/fixedbugs/bug120.go +++ b/test/fixedbugs/bug120.go @@ -53,6 +53,6 @@ func main() { } } if !ok { - sys.exit(1); + sys.Exit(1); } } diff --git a/test/if1.go b/test/if1.go index 81b041475..1784d8239 100644 --- a/test/if1.go +++ b/test/if1.go @@ -9,10 +9,10 @@ package main func main() { count := 7; if one := 1; { - count = count + one + count = count + one } if count != 8 { print(count, " should be 8\n"); - sys.exit(1) + sys.Exit(1) } } diff --git a/test/int_lit.go b/test/int_lit.go index f7311dd25..4121070f3 100644 --- a/test/int_lit.go +++ b/test/int_lit.go @@ -7,7 +7,7 @@ package main func main() { - s := + s := 0 + 123 + 0123 + @@ -18,6 +18,6 @@ func main() { 0X123; if s != 788 { print("s is ", s, "; should be 788\n"); - sys.exit(1); + sys.Exit(1); } } diff --git a/test/interface4.go b/test/interface4.go index 0d7223500..a55936df8 100644 --- a/test/interface4.go +++ b/test/interface4.go @@ -70,6 +70,6 @@ func main() { nonptrs(); if bad { - sys.exit(1) + sys.Exit(1) } } diff --git a/test/interface6.go b/test/interface6.go index b4a14fb94..6053e51d6 100644 --- a/test/interface6.go +++ b/test/interface6.go @@ -145,6 +145,6 @@ func main() { f11(); f12(); if fail > 0 { - sys.exit(1) + sys.Exit(1) } } diff --git a/test/ken/chan.go b/test/ken/chan.go index ba1337587..a272c2bbc 100644 --- a/test/ken/chan.go +++ b/test/ken/chan.go @@ -88,7 +88,7 @@ send(c *Chan) nproc++; // total goroutines running for { for r:=nrand(10); r>=0; r-- { - sys.gosched(); + sys.Gosched(); } c.sc <- c.sv; if c.send() { @@ -119,7 +119,7 @@ recv(c *Chan) nproc++; // total goroutines running for { for r:=nrand(10); r>=0; r-- { - sys.gosched(); + sys.Gosched(); } v = <-c.rc; if c.recv(v) { @@ -148,7 +148,7 @@ sel(r0,r1,r2,r3, s0,s1,s2,s3 *Chan) for { for r:=nrand(5); r>=0; r-- { - sys.gosched(); + sys.Gosched(); } select { @@ -270,9 +270,9 @@ test6(c int) func wait() { - sys.gosched(); + sys.Gosched(); for nproc != 0 { - sys.gosched(); + sys.Gosched(); } } @@ -321,7 +321,7 @@ main() if tots != t || totr != t { print("tots=", tots, " totr=", totr, " sb=", t, "\n"); - sys.exit(1); + sys.Exit(1); } - sys.exit(0); + sys.Exit(0); } diff --git a/test/readfile.go b/test/readfile.go index db8ca99e4..4853fd20e 100644 --- a/test/readfile.go +++ b/test/readfile.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// $G $F.go && $L $F.$A && ./$A.out readfile.go +// # $G $F.go && $L $F.$A && ./$A.out readfile.go // # This is some data we can recognize package main @@ -14,7 +14,7 @@ func main() { s, ok = sys.readfile("readfile.go"); if !ok { print("couldn't readfile\n"); - sys.exit(1) + sys.Exit(1) } start_of_file := "// $G $F.go && $L $F.$A && ./$A.out readfile.go\n" + @@ -23,6 +23,6 @@ func main() { "package main\n"; if s[0:102] != start_of_file { print("wrong data\n"); - sys.exit(1) + sys.Exit(1) } } diff --git a/test/string_lit.go b/test/string_lit.go index 219621484..5842eaa29 100644 --- a/test/string_lit.go +++ b/test/string_lit.go @@ -43,7 +43,7 @@ func main() { "本" "\a\b\f\n\r\t\v\\\"" "\000\123\x00\xca\xFE\u0123\ubabe\U0000babe" - + `` ` ` `'"` @@ -84,5 +84,5 @@ func main() { r = 0x10ffff + 1; s = string(r); assert(s, "\xef\xbf\xbd", "too-large rune"); - sys.exit(ecode); + sys.Exit(ecode); } diff --git a/test/switch1.go b/test/switch1.go index 003e473ef..fac9ac8ec 100644 --- a/test/switch1.go +++ b/test/switch1.go @@ -10,9 +10,9 @@ func main() { i := 0; switch x := 5; { case i < x: - sys.exit(0); + sys.Exit(0); case i == x: case i > x: - sys.exit(1); + sys.Exit(1); } } diff --git a/test/utf.go b/test/utf.go index 5905152b6..a93cb69db 100644 --- a/test/utf.go +++ b/test/utf.go @@ -6,6 +6,8 @@ package main +import "utf8" + func main() { var chars [6] int; chars[0] = 'a'; @@ -21,7 +23,7 @@ func main() { var l = len(s); for w, i, j := 0,0,0; i < l; i += w { var r int; - r, w = sys.stringtorune(s, i); + r, w = utf8.DecodeRuneInString(s, i); if w == 0 { panic("zero width in string") } if r != chars[j] { panic("wrong value from string") } j++; @@ -29,7 +31,7 @@ func main() { // encoded as bytes: 'a' 'b' 'c' e6 97 a5 e6 9c ac e8 aa 9e const L = 12; if L != l { panic("wrong length constructing array") } - a := new([L]byte); + a := make([]byte, L); a[0] = 'a'; a[1] = 'b'; a[2] = 'c'; @@ -44,7 +46,7 @@ func main() { a[11] = 0x9e; for w, i, j := 0,0,0; i < L; i += w { var r int; - r, w = sys.bytestorune(&a[0], i, L); + r, w = utf8.DecodeRune(a[i:L]); if w == 0 { panic("zero width in bytes") } if r != chars[j] { panic("wrong value from bytes") } j++; -- cgit v1.2.1