mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
change naming convention for tests from
test*.go to *test.go R=rsc DELTA=1747 (864 added, 855 deleted, 28 changed) OCL=19666 CL=19666
This commit is contained in:
parent
64023e7b7d
commit
12254b6c0b
18 changed files with 24 additions and 32 deletions
|
|
@ -290,7 +290,7 @@ char preamble[] =
|
||||||
"\n"
|
"\n"
|
||||||
"coverage: packages\n"
|
"coverage: packages\n"
|
||||||
"\tgotest\n"
|
"\tgotest\n"
|
||||||
"\t6cov -g `pwd` | grep -v '^test.*\\.go:'\n"
|
"\t6cov -g `pwd` | grep -v '^.*test\\.go:'\n"
|
||||||
"\n"
|
"\n"
|
||||||
"%%.$O: %%.go\n"
|
"%%.$O: %%.go\n"
|
||||||
"\t$(GC) $*.go\n"
|
"\t$(GC) $*.go\n"
|
||||||
|
|
@ -487,7 +487,7 @@ main(int argc, char **argv)
|
||||||
njob = 0;
|
njob = 0;
|
||||||
job = emalloc(argc*sizeof job[0]);
|
job = emalloc(argc*sizeof job[0]);
|
||||||
for(i=0; i<argc; i++) {
|
for(i=0; i<argc; i++) {
|
||||||
if(strncmp(argv[i], "test", 4) == 0)
|
if(strstr(argv[i], "test.go") != nil)
|
||||||
continue;
|
continue;
|
||||||
job[njob].name = argv[i];
|
job[njob].name = argv[i];
|
||||||
job[njob].pass = -1;
|
job[njob].pass = -1;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ done
|
||||||
|
|
||||||
case "x$gofiles" in
|
case "x$gofiles" in
|
||||||
x)
|
x)
|
||||||
gofiles=$(echo test*.go)
|
gofiles=$(echo *test.go)
|
||||||
esac
|
esac
|
||||||
|
|
||||||
ofiles=$(echo $gofiles | sed 's/\.go/.6/g')
|
ofiles=$(echo $gofiles | sed 's/\.go/.6/g')
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ test: packages
|
||||||
|
|
||||||
coverage: packages
|
coverage: packages
|
||||||
gotest
|
gotest
|
||||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||||
|
|
||||||
%.$O: %.go
|
%.$O: %.go
|
||||||
$(GC) $*.go
|
$(GC) $*.go
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ test: packages
|
||||||
|
|
||||||
coverage: packages
|
coverage: packages
|
||||||
gotest
|
gotest
|
||||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||||
|
|
||||||
%.$O: %.go
|
%.$O: %.go
|
||||||
$(GC) $*.go
|
$(GC) $*.go
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ test: packages
|
||||||
|
|
||||||
coverage: packages
|
coverage: packages
|
||||||
gotest
|
gotest
|
||||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||||
|
|
||||||
%.$O: %.go
|
%.$O: %.go
|
||||||
$(GC) $*.go
|
$(GC) $*.go
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Copyright 2009 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.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
make
|
|
||||||
6g test.go
|
|
||||||
6l test.6
|
|
||||||
./6.out
|
|
||||||
rm -f *.6 6.out
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package main
|
package reflect
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect";
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var doprint bool = false
|
var doprint bool = false
|
||||||
|
|
@ -87,7 +88,7 @@ export type empty interface {}
|
||||||
|
|
||||||
export type T struct { a int; b float64; c string; d *int }
|
export type T struct { a int; b float64; c string; d *int }
|
||||||
|
|
||||||
func main() {
|
export func TestAll(tt *testing.T) { // TODO(r): wrap up better
|
||||||
var s string;
|
var s string;
|
||||||
var t reflect.Type;
|
var t reflect.Type;
|
||||||
|
|
||||||
|
|
@ -168,30 +169,30 @@ func main() {
|
||||||
var i int = 7;
|
var i int = 7;
|
||||||
var tmp = &T{123, 456.75, "hello", &i};
|
var tmp = &T{123, 456.75, "hello", &i};
|
||||||
value := reflect.NewValue(tmp);
|
value := reflect.NewValue(tmp);
|
||||||
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "main.T{123, 456.75, hello, *int(@)}");
|
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.T{123, 456.75, hello, *int(@)}");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
type C chan *T; // TODO: should not be necessary
|
type C chan *T; // TODO: should not be necessary
|
||||||
var tmp = new(C);
|
var tmp = new(C);
|
||||||
value := reflect.NewValue(tmp);
|
value := reflect.NewValue(tmp);
|
||||||
assert(reflect.ValueToString(value), "*main.C·test(@)");
|
assert(reflect.ValueToString(value), "*reflect.C·test(@)");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
type A [10]int;
|
type A [10]int;
|
||||||
var tmp A = A{1,2,3,4,5,6,7,8,9,10};
|
var tmp A = A{1,2,3,4,5,6,7,8,9,10};
|
||||||
value := reflect.NewValue(&tmp);
|
value := reflect.NewValue(&tmp);
|
||||||
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "main.A·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
|
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
|
||||||
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
|
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
|
||||||
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "main.A·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
|
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.A·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
type AA []int;
|
type AA []int;
|
||||||
tmp1 := [10]int{1,2,3,4,5,6,7,8,9,10}; // TODO: should not be necessary to use tmp1
|
tmp1 := [10]int{1,2,3,4,5,6,7,8,9,10}; // TODO: should not be necessary to use tmp1
|
||||||
var tmp *AA = &tmp1;
|
var tmp *AA = &tmp1;
|
||||||
value := reflect.NewValue(tmp);
|
value := reflect.NewValue(tmp);
|
||||||
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "main.AA·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
|
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·test{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}");
|
||||||
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
|
value.(reflect.PtrValue).Sub().(reflect.ArrayValue).Elem(4).(reflect.IntValue).Set(123);
|
||||||
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "main.AA·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
|
assert(reflect.ValueToString(value.(reflect.PtrValue).Sub()), "reflect.AA·test{1, 2, 3, 4, 123, 6, 7, 8, 9, 10}");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ test: packages
|
||||||
|
|
||||||
coverage: packages
|
coverage: packages
|
||||||
gotest
|
gotest
|
||||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||||
|
|
||||||
%.$O: %.go
|
%.$O: %.go
|
||||||
$(GC) $*.go
|
$(GC) $*.go
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ test: packages
|
||||||
|
|
||||||
coverage: packages
|
coverage: packages
|
||||||
gotest
|
gotest
|
||||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||||
|
|
||||||
%.$O: %.go
|
%.$O: %.go
|
||||||
$(GC) $*.go
|
$(GC) $*.go
|
||||||
|
|
@ -33,8 +33,8 @@ coverage: packages
|
||||||
|
|
||||||
O1=\
|
O1=\
|
||||||
atoi.$O\
|
atoi.$O\
|
||||||
itoa.$O\
|
|
||||||
decimal.$O\
|
decimal.$O\
|
||||||
|
itoa.$O\
|
||||||
|
|
||||||
O2=\
|
O2=\
|
||||||
ftoa.$O\
|
ftoa.$O\
|
||||||
|
|
@ -45,7 +45,7 @@ O3=\
|
||||||
strconv.a: a1 a2 a3
|
strconv.a: a1 a2 a3
|
||||||
|
|
||||||
a1: $(O1)
|
a1: $(O1)
|
||||||
$(AR) grc strconv.a atoi.$O itoa.$O decimal.$O
|
$(AR) grc strconv.a atoi.$O decimal.$O itoa.$O
|
||||||
rm -f $(O1)
|
rm -f $(O1)
|
||||||
|
|
||||||
a2: $(O2)
|
a2: $(O2)
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,9 @@ func TRunner(t *T, test *Test) {
|
||||||
|
|
||||||
export func Main(tests *[]Test) {
|
export func Main(tests *[]Test) {
|
||||||
ok := true;
|
ok := true;
|
||||||
|
if len(tests) == 0 {
|
||||||
|
println("gotest: warning: no tests to run");
|
||||||
|
}
|
||||||
for i := 0; i < len(tests); i++ {
|
for i := 0; i < len(tests); i++ {
|
||||||
if chatty {
|
if chatty {
|
||||||
println("=== RUN ", tests[i].name);
|
println("=== RUN ", tests[i].name);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ make test
|
||||||
(xcd lib/reflect
|
(xcd lib/reflect
|
||||||
make clean
|
make clean
|
||||||
time make
|
time make
|
||||||
bash test.bash
|
make test
|
||||||
) || exit $?
|
) || exit $?
|
||||||
|
|
||||||
(xcd lib/regexp
|
(xcd lib/regexp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue