github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/test_regexps.txt (about) 1 go test -cpu=1 -run=X/Y -bench=X/Y -count=2 -v testregexp 2 3 # Test the following: 4 5 # TestX is run, twice 6 stdout -count=2 '^=== RUN TestX$' 7 stdout -count=2 '^ TestX: x_test.go:6: LOG: X running$' 8 9 # TestX/Y is run, twice 10 stdout -count=2 '^=== RUN TestX/Y$' 11 stdout -count=2 '^ TestX/Y: x_test.go:8: LOG: Y running$' 12 13 # TestXX is run, twice 14 stdout -count=2 '^=== RUN TestXX$' 15 stdout -count=2 '^ TestXX: z_test.go:10: LOG: XX running' 16 17 # TestZ is not run 18 ! stdout '^=== RUN TestZ$' 19 20 # BenchmarkX is run with N=1 once, only to discover what sub-benchmarks it has, 21 # and should not print a final summary line. 22 stdout -count=1 '^\s+BenchmarkX: x_test.go:13: LOG: X running N=1$' 23 ! stdout '^\s+BenchmarkX: x_test.go:13: LOG: X running N=\d\d+' 24 ! stdout 'BenchmarkX\s+\d+' 25 26 # Same for BenchmarkXX. 27 stdout -count=1 '^\s+BenchmarkXX: z_test.go:18: LOG: XX running N=1$' 28 ! stdout '^\s+BenchmarkXX: z_test.go:18: LOG: XX running N=\d\d+' 29 ! stdout 'BenchmarkXX\s+\d+' 30 31 # BenchmarkX/Y is run in full twice due to -count=2. 32 # "Run in full" means that it runs for approximately the default benchtime, 33 # but may cap out at N=1e9. 34 # We don't actually care what the final iteration count is, but it should be 35 # a large number, and the last iteration count prints right before the results. 36 stdout -count=2 '^\s+BenchmarkX/Y: x_test.go:15: LOG: Y running N=[1-9]\d{4,}\nBenchmarkX/Y\s+\d+' 37 38 -- testregexp/x_test.go -- 39 package x 40 41 import "testing" 42 43 func TestX(t *testing.T) { 44 t.Logf("LOG: X running") 45 t.Run("Y", func(t *testing.T) { 46 t.Logf("LOG: Y running") 47 }) 48 } 49 50 func BenchmarkX(b *testing.B) { 51 b.Logf("LOG: X running N=%d", b.N) 52 b.Run("Y", func(b *testing.B) { 53 b.Logf("LOG: Y running N=%d", b.N) 54 }) 55 } 56 -- testregexp/z_test.go -- 57 package x 58 59 import "testing" 60 61 func TestZ(t *testing.T) { 62 t.Logf("LOG: Z running") 63 } 64 65 func TestXX(t *testing.T) { 66 t.Logf("LOG: XX running") 67 } 68 69 func BenchmarkZ(b *testing.B) { 70 b.Logf("LOG: Z running N=%d", b.N) 71 } 72 73 func BenchmarkXX(b *testing.B) { 74 b.Logf("LOG: XX running N=%d", b.N) 75 }