gotest.tools/gotestsum@v1.11.0/testjson/internal/good/good_test.go (about) 1 //go:build stubpkg 2 // +build stubpkg 3 4 package good 5 6 import ( 7 "fmt" 8 "os" 9 "testing" 10 "time" 11 ) 12 13 func TestPassed(t *testing.T) {} 14 15 func TestPassedWithLog(t *testing.T) { 16 Something() 17 t.Log("this is a log") 18 } 19 20 func TestPassedWithStdout(t *testing.T) { 21 fmt.Println("this is a Print") 22 } 23 24 func TestSkipped(t *testing.T) { 25 t.Skip() 26 } 27 28 func TestSkippedWitLog(t *testing.T) { 29 t.Skip("the skip message") 30 } 31 32 func TestWithStderr(t *testing.T) { 33 fmt.Fprintln(os.Stderr, "this is stderr") 34 } 35 36 func TestParallelTheFirst(t *testing.T) { 37 t.Parallel() 38 time.Sleep(10 * time.Millisecond) 39 } 40 41 func TestParallelTheSecond(t *testing.T) { 42 t.Parallel() 43 time.Sleep(6 * time.Millisecond) 44 } 45 46 func TestParallelTheThird(t *testing.T) { 47 t.Parallel() 48 time.Sleep(2 * time.Millisecond) 49 } 50 51 func TestNestedSuccess(t *testing.T) { 52 for _, name := range []string{"a", "b", "c", "d"} { 53 t.Run(name, func(t *testing.T) { 54 t.Run("sub", func(t *testing.T) {}) 55 }) 56 } 57 }