]> Cypherpunks repositories - gostls13.git/commitdiff
change naming convention for tests from
authorRob Pike <r@golang.org>
Thu, 20 Nov 2008 03:11:01 +0000 (19:11 -0800)
committerRob Pike <r@golang.org>
Thu, 20 Nov 2008 03:11:01 +0000 (19:11 -0800)
test*.go
to
*test.go

R=rsc
DELTA=1747  (864 added, 855 deleted, 28 changed)
OCL=19666
CL=19666

18 files changed:
src/cmd/gobuild/gobuild.c
src/cmd/gotest/gotest
src/lib/container/array/Makefile
src/lib/container/array/array_test.go [moved from src/lib/container/array/testarray.go with 100% similarity]
src/lib/math/Makefile
src/lib/reflect/Makefile
src/lib/reflect/test.bash [deleted file]
src/lib/reflect/test.go
src/lib/regexp/Makefile
src/lib/strconv/Makefile
src/lib/strconv/atof_test.go [moved from src/lib/strconv/testatof.go with 100% similarity]
src/lib/strconv/atoi_test.go [moved from src/lib/strconv/testatoi.go with 100% similarity]
src/lib/strconv/decimal_test.go [moved from src/lib/strconv/testdecimal.go with 100% similarity]
src/lib/strconv/fp_test.go [moved from src/lib/strconv/testfp.go with 100% similarity]
src/lib/strconv/ftoa_test.go [moved from src/lib/strconv/testftoa.go with 100% similarity]
src/lib/strconv/itoa_test.go [moved from src/lib/strconv/testitoa.go with 100% similarity]
src/lib/testing.go
src/run.bash

index 1056d883adf820c6dead6956ccce6bf0dadb9d35..07a7862f6c650ca452dc9685e2a34bc6106ac4fe 100644 (file)
@@ -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;
index 85699547beeaed00835d9ee16060fbee86c32a95..9bf7270bff43b2872a2fa463f050310d39999cd8 100755 (executable)
@@ -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')
index 6494a31507e4db54200de405e8be2b6e09b325d9..f16d43cd5e5e9767d0c8af6a5dab4e6154122c0c 100644 (file)
@@ -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
index 0c5d5a1ee56ab82964cc4b6b0b709e8d95d71e76..5bfa6adcfb61ada8274dbd51b0d7f9fcc306a2eb 100644 (file)
@@ -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
index 68870a33a6ed23de43b066bdfbed1f9a299c135c..d6fafc5c5f4ba1b71fccb9a4163b79efacc21744 100644 (file)
@@ -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
diff --git a/src/lib/reflect/test.bash b/src/lib/reflect/test.bash
deleted file mode 100755 (executable)
index 1e9e0c9..0000000
+++ /dev/null
@@ -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
index 8497380c78274593856c550c6c6362f9e28808b2..feb99e61dc2cb4fbaa09af89ed48f60bc21189a9 100644 (file)
@@ -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}");
        }
 
        {
index 3e82f1c1f6e533e2c8e958766cd853146bd1cfed..ec4a5644e5f24128c4f47fefb212f7301135606e 100644 (file)
@@ -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
index 454ef142fd33b1eb99f040a45a47ff59b0e4dddf..8d9466963b5b27b6d5088d49dbf1ad4d74d65302 100644 (file)
@@ -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)
index be82cbdebedc26b2e333f726f733792f3108e87b..3a95d61d7bf0fb5af10910735a5134a0725b690a 100644 (file)
@@ -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);
index 5d759cfaf9cf908faac146ad7f88ec82d0df2523..8dc40403967ebcf7cfd9222ae6bc4cbfe19e5a05 100755 (executable)
@@ -20,7 +20,7 @@ make test
 (xcd lib/reflect
 make clean
 time make
-bash test.bash
+make test
 ) || exit $?
 
 (xcd lib/regexp