aboutsummaryrefslogtreecommitdiff
path: root/src/lib/reflect
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-11-19 19:11:01 -0800
committerRob Pike <r@golang.org>2008-11-19 19:11:01 -0800
commit12254b6c0bc9d3f6689f12d64f7bd4cb4d20d53f (patch)
tree81b27c09f43aede65a97648aa943b2901e9f2c3b /src/lib/reflect
parent64023e7b7d8ce78af2f08564dfcccca243a64a17 (diff)
downloadgo-12254b6c0bc9d3f6689f12d64f7bd4cb4d20d53f.tar.xz
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
Diffstat (limited to 'src/lib/reflect')
-rw-r--r--src/lib/reflect/Makefile2
-rwxr-xr-xsrc/lib/reflect/test.bash12
-rw-r--r--src/lib/reflect/test.go19
3 files changed, 11 insertions, 22 deletions
diff --git a/src/lib/reflect/Makefile b/src/lib/reflect/Makefile
index 68870a33a6..d6fafc5c5f 100644
--- a/src/lib/reflect/Makefile
+++ b/src/lib/reflect/Makefile
@@ -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
index 1e9e0c9560..0000000000
--- a/src/lib/reflect/test.bash
+++ /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
diff --git a/src/lib/reflect/test.go b/src/lib/reflect/test.go
index 8497380c78..feb99e61dc 100644
--- a/src/lib/reflect/test.go
+++ b/src/lib/reflect/test.go
@@ -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}");
}
{