mirror of
https://github.com/golang/go
synced 2024-11-13 18:20:32 -07: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
@ -290,7 +290,7 @@ char preamble[] =
|
||||
"\n"
|
||||
"coverage: packages\n"
|
||||
"\tgotest\n"
|
||||
"\t6cov -g `pwd` | grep -v '^test.*\\.go:'\n"
|
||||
"\t6cov -g `pwd` | grep -v '^.*test\\.go:'\n"
|
||||
"\n"
|
||||
"%%.$O: %%.go\n"
|
||||
"\t$(GC) $*.go\n"
|
||||
@ -487,7 +487,7 @@ main(int argc, char **argv)
|
||||
njob = 0;
|
||||
job = emalloc(argc*sizeof job[0]);
|
||||
for(i=0; i<argc; i++) {
|
||||
if(strncmp(argv[i], "test", 4) == 0)
|
||||
if(strstr(argv[i], "test.go") != nil)
|
||||
continue;
|
||||
job[njob].name = argv[i];
|
||||
job[njob].pass = -1;
|
||||
|
@ -27,7 +27,7 @@ done
|
||||
|
||||
case "x$gofiles" in
|
||||
x)
|
||||
gofiles=$(echo test*.go)
|
||||
gofiles=$(echo *test.go)
|
||||
esac
|
||||
|
||||
ofiles=$(echo $gofiles | sed 's/\.go/.6/g')
|
||||
|
@ -20,7 +20,7 @@ test: packages
|
||||
|
||||
coverage: packages
|
||||
gotest
|
||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
||||
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||
|
||||
%.$O: %.go
|
||||
$(GC) $*.go
|
||||
|
@ -20,7 +20,7 @@ test: packages
|
||||
|
||||
coverage: packages
|
||||
gotest
|
||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
||||
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||
|
||||
%.$O: %.go
|
||||
$(GC) $*.go
|
||||
|
@ -20,7 +20,7 @@ test: packages
|
||||
|
||||
coverage: packages
|
||||
gotest
|
||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
||||
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||
|
||||
%.$O: %.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
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
package reflect
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"reflect";
|
||||
"testing"
|
||||
)
|
||||
|
||||
var doprint bool = false
|
||||
@ -87,7 +88,7 @@ export type empty interface {}
|
||||
|
||||
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 t reflect.Type;
|
||||
|
||||
@ -168,30 +169,30 @@ func main() {
|
||||
var i int = 7;
|
||||
var tmp = &T{123, 456.75, "hello", &i};
|
||||
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
|
||||
var tmp = new(C);
|
||||
value := reflect.NewValue(tmp);
|
||||
assert(reflect.ValueToString(value), "*main.C·test(@)");
|
||||
assert(reflect.ValueToString(value), "*reflect.C·test(@)");
|
||||
}
|
||||
{
|
||||
type A [10]int;
|
||||
var tmp A = A{1,2,3,4,5,6,7,8,9,10};
|
||||
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);
|
||||
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;
|
||||
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;
|
||||
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);
|
||||
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
|
||||
gotest
|
||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
||||
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||
|
||||
%.$O: %.go
|
||||
$(GC) $*.go
|
||||
|
@ -20,7 +20,7 @@ test: packages
|
||||
|
||||
coverage: packages
|
||||
gotest
|
||||
6cov -g `pwd` | grep -v '^test.*\.go:'
|
||||
6cov -g `pwd` | grep -v '^.*test\.go:'
|
||||
|
||||
%.$O: %.go
|
||||
$(GC) $*.go
|
||||
@ -33,8 +33,8 @@ coverage: packages
|
||||
|
||||
O1=\
|
||||
atoi.$O\
|
||||
itoa.$O\
|
||||
decimal.$O\
|
||||
itoa.$O\
|
||||
|
||||
O2=\
|
||||
ftoa.$O\
|
||||
@ -45,7 +45,7 @@ O3=\
|
||||
strconv.a: a1 a2 a3
|
||||
|
||||
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)
|
||||
|
||||
a2: $(O2)
|
||||
|
@ -74,6 +74,9 @@ func TRunner(t *T, test *Test) {
|
||||
|
||||
export func Main(tests *[]Test) {
|
||||
ok := true;
|
||||
if len(tests) == 0 {
|
||||
println("gotest: warning: no tests to run");
|
||||
}
|
||||
for i := 0; i < len(tests); i++ {
|
||||
if chatty {
|
||||
println("=== RUN ", tests[i].name);
|
||||
|
@ -20,7 +20,7 @@ make test
|
||||
(xcd lib/reflect
|
||||
make clean
|
||||
time make
|
||||
bash test.bash
|
||||
make test
|
||||
) || exit $?
|
||||
|
||||
(xcd lib/regexp
|
||||
|
Loading…
Reference in New Issue
Block a user