}))
}
-func TestListTests(t *testing.T) {
- tooSlow(t)
- var tg *testgoData
- testWith := func(listName, expected string) func(*testing.T) {
- return func(t *testing.T) {
- tg = testgo(t)
- defer tg.cleanup()
- tg.run("test", "./testdata/src/testlist/...", fmt.Sprintf("-list=%s", listName))
- tg.grepStdout(expected, fmt.Sprintf("-test.list=%s returned %q, expected %s", listName, tg.getStdout(), expected))
- }
- }
-
- t.Run("Test", testWith("Test", "TestSimple"))
- t.Run("Bench", testWith("Benchmark", "BenchmarkSimple"))
- t.Run("Example1", testWith("Example", "ExampleSimple"))
- t.Run("Example2", testWith("Example", "ExampleWithEmptyOutput"))
-}
-
func TestBuildmodePIE(t *testing.T) {
if testing.Short() && testenv.Builder() == "" {
t.Skipf("skipping in -short mode on non-builder")
--- /dev/null
+[short] skip
+
+cd $WORK
+
+# Test
+go test './gopath/src/testlist/...' -list=Test
+stdout TestSimple
+
+# Benchmark
+go test './gopath/src/testlist/...' -list=Benchmark
+stdout BenchmarkSimple
+
+# Examples
+go test './gopath/src/testlist/...' -list=Example
+stdout ExampleSimple
+stdout ExampleWithEmptyOutput
+
+-- testlist/bench_test.go --
+package testlist
+
+import (
+ "fmt"
+ "testing"
+)
+
+func BenchmarkSimplefunc(b *testing.B) {
+ b.StopTimer()
+ b.StartTimer()
+ for i := 0; i < b.N; i++ {
+ _ = fmt.Sprint("Test for bench")
+ }
+}
+-- testlist/example_test.go --
+package testlist
+
+import (
+ "fmt"
+)
+
+func ExampleSimple() {
+ fmt.Println("Test with Output.")
+
+ // Output: Test with Output.
+}
+
+func ExampleWithEmptyOutput() {
+ fmt.Println("")
+
+ // Output:
+}
+
+func ExampleNoOutput() {
+ _ = fmt.Sprint("Test with no output")
+}
+-- testlist/test_test.go --
+package testlist
+
+import (
+ "fmt"
+ "testing"
+)
+
+func TestSimple(t *testing.T) {
+ _ = fmt.Sprint("Test simple")
+}
\ No newline at end of file
+++ /dev/null
-package testlist
-
-import (
- "fmt"
- "testing"
-)
-
-func BenchmarkSimplefunc(b *testing.B) {
- b.StopTimer()
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- _ = fmt.Sprint("Test for bench")
- }
-}
+++ /dev/null
-package testlist
-
-import (
- "fmt"
-)
-
-func ExampleSimple() {
- fmt.Println("Test with Output.")
-
- // Output: Test with Output.
-}
-
-func ExampleWithEmptyOutput() {
- fmt.Println("")
-
- // Output:
-}
-
-func ExampleNoOutput() {
- _ = fmt.Sprint("Test with no output")
-}
+++ /dev/null
-package testlist
-
-import (
- "fmt"
- "testing"
-)
-
-func TestSimple(t *testing.T) {
- _ = fmt.Sprint("Test simple")
-}