diff --git a/misc/cgo/test/align.go b/misc/cgo/test/align.go index 2d2979595c..07ab9ef503 100644 --- a/misc/cgo/test/align.go +++ b/misc/cgo/test/align.go @@ -58,7 +58,7 @@ import ( "testing" ) -func TestAlign(t *testing.T) { +func testAlign(t *testing.T) { var evt C.SDL_KeyboardEvent C.makeEvent(&evt) if C.same(&evt, evt.typ, evt.which, evt.state, evt.keysym.scancode, evt.keysym.sym, evt.keysym.mod, evt.keysym.unicode) == 0 { diff --git a/misc/cgo/test/basic.go b/misc/cgo/test/basic.go index a94074c52e..b9d0953bd3 100644 --- a/misc/cgo/test/basic.go +++ b/misc/cgo/test/basic.go @@ -90,31 +90,31 @@ func Atol(s string) int { return int(n) } -func TestConst(t *testing.T) { +func testConst(t *testing.T) { C.myConstFunc(nil, 0, nil) } -func TestEnum(t *testing.T) { +func testEnum(t *testing.T) { if C.Enum1 != 1 || C.Enum2 != 2 { t.Error("bad enum", C.Enum1, C.Enum2) } } -func TestAtol(t *testing.T) { +func testAtol(t *testing.T) { l := Atol("123") if l != 123 { t.Error("Atol 123: ", l) } } -func TestErrno(t *testing.T) { +func testErrno(t *testing.T) { n, err := Strtol("asdf", 123) if n != 0 || err != os.EINVAL { t.Error("Strtol: ", n, err) } } -func TestMultipleAssign(t *testing.T) { +func testMultipleAssign(t *testing.T) { p := C.CString("234") n, m := C.strtol(p, nil, 345), C.strtol(p, nil, 10) if n != 0 || m != 234 { diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go index 450a7cbf26..3edee97581 100644 --- a/misc/cgo/test/callback.go +++ b/misc/cgo/test/callback.go @@ -27,7 +27,7 @@ func goCallback(p unsafe.Pointer) { (*(*func())(unsafe.Pointer(&p)))() } -func TestCallback(t *testing.T) { +func testCallback(t *testing.T) { var x = false nestedCall(func() { x = true }) if !x { @@ -35,13 +35,13 @@ func TestCallback(t *testing.T) { } } -func TestCallbackGC(t *testing.T) { +func testCallbackGC(t *testing.T) { nestedCall(runtime.GC) } func lockedOSThread() bool // in runtime.c -func TestCallbackPanic(t *testing.T) { +func testCallbackPanic(t *testing.T) { // Make sure panic during callback unwinds properly. if lockedOSThread() { t.Fatal("locked OS thread on entry to TestCallbackPanic") @@ -62,14 +62,14 @@ func TestCallbackPanic(t *testing.T) { panic("nestedCall returned") } -func TestCallbackPanicLoop(t *testing.T) { +func testCallbackPanicLoop(t *testing.T) { // Make sure we don't blow out m->g0 stack. for i := 0; i < 100000; i++ { TestCallbackPanic(t) } } -func TestCallbackPanicLocked(t *testing.T) { +func testCallbackPanicLocked(t *testing.T) { runtime.LockOSThread() defer runtime.UnlockOSThread() @@ -94,7 +94,7 @@ func TestCallbackPanicLocked(t *testing.T) { // Callback with zero arguments used to make the stack misaligned, // which broke the garbage collector and other things. -func TestZeroArgCallback(t *testing.T) { +func testZeroArgCallback(t *testing.T) { defer func() { s := recover() if s != nil { @@ -118,7 +118,7 @@ func goFoo() { func variadic(x ...interface{}) {} -func TestBlocking(t *testing.T) { +func testBlocking(t *testing.T) { c := make(chan int) go func() { for i := 0; i < 10; i++ { diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go index 967dc0e924..e23da15770 100644 --- a/misc/cgo/test/cgo_test.go +++ b/misc/cgo/test/cgo_test.go @@ -1,5 +1,27 @@ +// Copyright 2011 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. + package cgotest -// dummy file so gotest thinks there are tests. -// the actual tests are in the main go files, next -// to the code they test. +import "testing" + +// The actual test functions are in non-_test.go files +// so that they can use cgo (import "C"). +// These wrappers are here for gotest to find. + +func TestAlign(t *testing.T) { testAlign(t) } +func TestConst(t *testing.T) { testConst(t) } +func TestEnum(t *testing.T) { testEnum(t) } +func TestAtol(t *testing.T) { testAtol(t) } +func TestErrno(t *testing.T) { testErrno(t) } +func TestMultipleAssign(t *testing.T) { testMultipleAssign(t) } +func TestCallback(t *testing.T) { testCallback(t) } +func TestCallbackGC(t *testing.T) { testCallbackGC(t) } +func TestCallbackPanic(t *testing.T) { testCallbackPanic(t) } +func TestCallbackPanicLoop(t *testing.T) { testCallbackPanicLoop(t) } +func TestCallbackPanicLocked(t *testing.T) { testCallbackPanicLocked(t) } +func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) } +func TestBlocking(t *testing.T) { testBlocking(t) } +func Test1328(t *testing.T) { test1328(t) } +func TestParallelSleep(t *testing.T) { testParallelSleep(t) } diff --git a/misc/cgo/test/issue1328.go b/misc/cgo/test/issue1328.go index f29d7057e9..e01207dd9b 100644 --- a/misc/cgo/test/issue1328.go +++ b/misc/cgo/test/issue1328.go @@ -25,6 +25,6 @@ func BackIntoGo() { func xvariadic(x ...interface{}) { } -func Test1328(t *testing.T) { +func test1328(t *testing.T) { C.IntoC() } diff --git a/misc/cgo/test/issue1560.go b/misc/cgo/test/issue1560.go index 75d31c0359..e534cce473 100644 --- a/misc/cgo/test/issue1560.go +++ b/misc/cgo/test/issue1560.go @@ -35,7 +35,7 @@ func BackgroundSleep(n int) { }() } -func TestParallelSleep(t *testing.T) { +func testParallelSleep(t *testing.T) { dt := -time.Nanoseconds() parallelSleep(1) dt += time.Nanoseconds()