github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/src/failfast_test.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package failfast 6 7 import "testing" 8 9 func TestA(t *testing.T) { 10 // Edge-case testing, mixing unparallel tests too 11 t.Logf("LOG: %s", t.Name()) 12 } 13 14 func TestFailingA(t *testing.T) { 15 t.Errorf("FAIL - %s", t.Name()) 16 } 17 18 func TestB(t *testing.T) { 19 // Edge-case testing, mixing unparallel tests too 20 t.Logf("LOG: %s", t.Name()) 21 } 22 23 func TestParallelFailingA(t *testing.T) { 24 t.Parallel() 25 t.Errorf("FAIL - %s", t.Name()) 26 } 27 28 func TestParallelFailingB(t *testing.T) { 29 t.Parallel() 30 t.Errorf("FAIL - %s", t.Name()) 31 } 32 33 func TestParallelFailingSubtestsA(t *testing.T) { 34 t.Parallel() 35 t.Run("TestFailingSubtestsA1", func(t *testing.T) { 36 t.Errorf("FAIL - %s", t.Name()) 37 }) 38 t.Run("TestFailingSubtestsA2", func(t *testing.T) { 39 t.Errorf("FAIL - %s", t.Name()) 40 }) 41 } 42 43 func TestFailingSubtestsA(t *testing.T) { 44 t.Run("TestFailingSubtestsA1", func(t *testing.T) { 45 t.Errorf("FAIL - %s", t.Name()) 46 }) 47 t.Run("TestFailingSubtestsA2", func(t *testing.T) { 48 t.Errorf("FAIL - %s", t.Name()) 49 }) 50 } 51 52 func TestFailingB(t *testing.T) { 53 t.Errorf("FAIL - %s", t.Name()) 54 } 55 56 func TestFatalC(t *testing.T) { 57 t.Fatalf("FAIL - %s", t.Name()) 58 } 59 60 func TestFatalD(t *testing.T) { 61 t.Fatalf("FAIL - %s", t.Name()) 62 }