| 1 |
package suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/ |
| 2 |
|
| 3 |
import ( |
| 4 |
"bytesscip-go gomod github.com/golang/go/src go1.17 bytes/" |
| 5 |
"errorsscip-go gomod github.com/golang/go/src go1.17 errors/" |
| 6 |
"flagscip-go gomod github.com/golang/go/src go1.17 flag/" |
| 7 |
"ioscip-go gomod github.com/golang/go/src go1.17 io/" |
| 8 |
"math/randscip-go gomod github.com/golang/go/src go1.17 `math/rand`/" |
| 9 |
"osscip-go gomod github.com/golang/go/src go1.17 os/" |
| 10 |
"os/execscip-go gomod github.com/golang/go/src go1.17 `os/exec`/" |
| 11 |
"stringsscip-go gomod github.com/golang/go/src go1.17 strings/" |
| 12 |
"testingscip-go gomod github.com/golang/go/src go1.17 testing/" |
| 13 |
"timescip-go gomod github.com/golang/go/src go1.17 time/" |
| 14 |
|
| 15 |
"github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/" |
| 16 |
"github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/" |
| 17 |
) |
| 18 |
|
| 19 |
// allTestsFilter is a yes filter for testing.RunTests |
| 20 |
func allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter().(pat, str string) (bool, error) { |
| 21 |
return true, nil |
| 22 |
} |
| 23 |
|
| 24 |
// SuiteRequireTwice is intended to test the usage of suite.Require in two |
| 25 |
// different tests |
| 26 |
type SuiteRequireTwicescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice# struct{ Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#Suite. } |
| 27 |
|
| 28 |
// TestSuiteRequireTwice checks for regressions of issue #149 where |
| 29 |
// suite.requirements was not initialized in suite.SetT() |
| 30 |
// A regression would result on these tests panicking rather than failing. |
| 31 |
func TestSuiteRequireTwicescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteRequireTwice().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 32 |
ok := testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().( |
| 33 |
allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., |
| 34 |
[]testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{{ |
| 35 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/SuiteRequireTwice", |
| 36 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 37 |
suite := new(SuiteRequireTwicescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#) |
| 38 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suite) |
| 39 |
}, |
| 40 |
}}, |
| 41 |
) |
| 42 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, ok) |
| 43 |
} |
| 44 |
|
| 45 |
func (s *SuiteRequireTwicescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#) TestRequireOnescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#TestRequireOne().() { |
| 46 |
r := s.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().() |
| 47 |
r.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/Assertions#Equal().(1, 2) |
| 48 |
} |
| 49 |
|
| 50 |
func (s *SuiteRequireTwicescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#) TestRequireTwoscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteRequireTwice#TestRequireTwo().() { |
| 51 |
r := s.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().() |
| 52 |
r.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/Assertions#Equal().(1, 2) |
| 53 |
} |
| 54 |
|
| 55 |
type panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite# struct { |
| 56 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#Suite. |
| 57 |
panicInSetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupSuite. bool |
| 58 |
panicInSetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupTest. bool |
| 59 |
panicInBeforeTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInBeforeTest. bool |
| 60 |
panicInTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTest. bool |
| 61 |
panicInAfterTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInAfterTest. bool |
| 62 |
panicInTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownTest. bool |
| 63 |
panicInTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownSuite. bool |
| 64 |
} |
| 65 |
|
| 66 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#SetupSuite().() { |
| 67 |
if s.panicInSetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupSuite. { |
| 68 |
panic("oops in setup suite") |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) SetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#SetupTest().() { |
| 73 |
if s.panicInSetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupTest. { |
| 74 |
panic("oops in setup test") |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) BeforeTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#BeforeTest().(_, _ string) { |
| 79 |
if s.panicInBeforeTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInBeforeTest. { |
| 80 |
panic("oops in before test") |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) Testscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#Test().() { |
| 85 |
if s.panicInTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTest. { |
| 86 |
panic("oops in test") |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) AfterTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#AfterTest().(_, _ string) { |
| 91 |
if s.panicInAfterTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInAfterTest. { |
| 92 |
panic("oops in after test") |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) TearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#TearDownTest().() { |
| 97 |
if s.panicInTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownTest. { |
| 98 |
panic("oops in tear down test") |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
func (s *panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#TearDownSuite().() { |
| 103 |
if s.panicInTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownSuite. { |
| 104 |
panic("oops in tear down suite") |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
func TestSuiteRecoverPanicscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteRecoverPanic().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 109 |
ok := true |
| 110 |
panickingTests := []testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{ |
| 111 |
{ |
| 112 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InSetupSuite", |
| 113 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInSetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupSuite.: true}) }, |
| 114 |
}, |
| 115 |
{ |
| 116 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InSetupTest", |
| 117 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInSetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInSetupTest.: true}) }, |
| 118 |
}, |
| 119 |
{ |
| 120 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "InBeforeTest", |
| 121 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInBeforeTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInBeforeTest.: true}) }, |
| 122 |
}, |
| 123 |
{ |
| 124 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InTest", |
| 125 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTest.: true}) }, |
| 126 |
}, |
| 127 |
{ |
| 128 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InAfterTest", |
| 129 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInAfterTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInAfterTest.: true}) }, |
| 130 |
}, |
| 131 |
{ |
| 132 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InTearDownTest", |
| 133 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownTest.: true}) }, |
| 134 |
}, |
| 135 |
{ |
| 136 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/InTearDownSuite", |
| 137 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, &panickingSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#{panicInTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/panickingSuite#panicInTearDownSuite.: true}) }, |
| 138 |
}, |
| 139 |
} |
| 140 |
|
| 141 |
requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/.NotPanicsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/NotPanics().(t, func() { |
| 142 |
ok = testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().(allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., panickingTests) |
| 143 |
}) |
| 144 |
|
| 145 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, ok) |
| 146 |
} |
| 147 |
|
| 148 |
// This suite is intended to store values to make sure that only |
| 149 |
// testing-suite-related methods are run. It's also a fully |
| 150 |
// functional example of a testing suite, using setup/teardown methods |
| 151 |
// and a helper method that is ignored by testify. To make this look |
| 152 |
// more like a real world example, all tests in the suite perform some |
| 153 |
// type of assertion. |
| 154 |
type SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester# struct { |
| 155 |
// Include our basic suite logic. |
| 156 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#Suite. |
| 157 |
|
| 158 |
// Keep counts of how many times each method is run. |
| 159 |
SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSuiteRunCount. int |
| 160 |
TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSuiteRunCount. int |
| 161 |
SetupTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupTestRunCount. int |
| 162 |
TearDownTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownTestRunCount. int |
| 163 |
TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount. int |
| 164 |
TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount. int |
| 165 |
TestSubtestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestSubtestRunCount. int |
| 166 |
NonTestMethodRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#NonTestMethodRunCount. int |
| 167 |
SetupSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestRunCount. int |
| 168 |
TearDownSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestRunCount. int |
| 169 |
|
| 170 |
SetupSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestNames. []string |
| 171 |
TearDownSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestNames. []string |
| 172 |
|
| 173 |
SuiteNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameBefore. []string |
| 174 |
TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore. []string |
| 175 |
|
| 176 |
SuiteNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameAfter. []string |
| 177 |
TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter. []string |
| 178 |
|
| 179 |
TimeBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeBefore. []timescip-go gomod github.com/golang/go/src go1.17 time/.Timescip-go gomod github.com/golang/go/src go1.17 time/Time# |
| 180 |
TimeAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeAfter. []timescip-go gomod github.com/golang/go/src go1.17 time/.Timescip-go gomod github.com/golang/go/src go1.17 time/Time# |
| 181 |
} |
| 182 |
|
| 183 |
// The SetupSuite method will be run by testify once, at the very |
| 184 |
// start of the testing suite, before any tests are run. |
| 185 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSuite().() { |
| 186 |
suite.SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSuiteRunCount.++ |
| 187 |
} |
| 188 |
|
| 189 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) BeforeTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#BeforeTest().(suiteName, testName string) { |
| 190 |
suite.SuiteNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameBefore. = append(suite.SuiteNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameBefore., suiteName) |
| 191 |
suite.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore. = append(suite.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., testName) |
| 192 |
suite.TimeBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeBefore. = append(suite.TimeBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeBefore., timescip-go gomod github.com/golang/go/src go1.17 time/.Nowscip-go gomod github.com/golang/go/src go1.17 time/Now().()) |
| 193 |
} |
| 194 |
|
| 195 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) AfterTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#AfterTest().(suiteName, testName string) { |
| 196 |
suite.SuiteNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameAfter. = append(suite.SuiteNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameAfter., suiteName) |
| 197 |
suite.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter. = append(suite.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., testName) |
| 198 |
suite.TimeAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeAfter. = append(suite.TimeAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeAfter., timescip-go gomod github.com/golang/go/src go1.17 time/.Nowscip-go gomod github.com/golang/go/src go1.17 time/Now().()) |
| 199 |
} |
| 200 |
|
| 201 |
// The TearDownSuite method will be run by testify once, at the very |
| 202 |
// end of the testing suite, after all tests have been run. |
| 203 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSuite().() { |
| 204 |
suite.TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSuiteRunCount.++ |
| 205 |
} |
| 206 |
|
| 207 |
// The SetupTest method will be run before every test in the suite. |
| 208 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) SetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupTest().() { |
| 209 |
suite.SetupTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupTestRunCount.++ |
| 210 |
} |
| 211 |
|
| 212 |
// The TearDownTest method will be run after every test in the suite. |
| 213 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownTest().() { |
| 214 |
suite.TearDownTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownTestRunCount.++ |
| 215 |
} |
| 216 |
|
| 217 |
// Every method in a testing suite that begins with "Test" will be run |
| 218 |
// as a test. TestOne is an example of a test. For the purposes of |
| 219 |
// this example, we've included assertions in the tests, since most |
| 220 |
// tests will issue assertions. |
| 221 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TestOnescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOne().() { |
| 222 |
beforeCount := suite.TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount. |
| 223 |
suite.TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount.++ |
| 224 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().(), suite.TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount., beforeCount+1) |
| 225 |
suite.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#Equal().(suite.TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount., beforeCount+1) |
| 226 |
} |
| 227 |
|
| 228 |
// TestTwo is another example of a test. |
| 229 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TestTwoscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwo().() { |
| 230 |
beforeCount := suite.TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount. |
| 231 |
suite.TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount.++ |
| 232 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotEqual().(suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().(), suite.TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount., beforeCount) |
| 233 |
suite.NotEqualscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#NotEqual().(suite.TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount., beforeCount) |
| 234 |
} |
| 235 |
|
| 236 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TestSkipscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestSkip().() { |
| 237 |
suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Skipscip-go gomod github.com/golang/go/src go1.17 testing/common#Skip().() |
| 238 |
} |
| 239 |
|
| 240 |
// NonTestMethod does not begin with "Test", so it will not be run by |
| 241 |
// testify as a test in the suite. This is useful for creating helper |
| 242 |
// methods for your tests. |
| 243 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) NonTestMethodscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#NonTestMethod().() { |
| 244 |
suite.NonTestMethodRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#NonTestMethodRunCount.++ |
| 245 |
} |
| 246 |
|
| 247 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TestSubtestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestSubtest().() { |
| 248 |
suite.TestSubtestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestSubtestRunCount.++ |
| 249 |
|
| 250 |
for _, t := range []struct { |
| 251 |
testName string |
| 252 |
}{ |
| 253 |
{"first"}, |
| 254 |
{"second"}, |
| 255 |
} { |
| 256 |
suiteT := suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().() |
| 257 |
suite.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().(t.testName, func() { |
| 258 |
// We should get a different *testing.T for subtests, so that |
| 259 |
// go test recognizes them as proper subtests for output formatting |
| 260 |
// and running individual subtests |
| 261 |
subTestT := suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().() |
| 262 |
suite.NotEqualscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#NotEqual().(subTestT, suiteT) |
| 263 |
}) |
| 264 |
suite.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#Equal().(suiteT, suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().()) |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) TearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTest().() { |
| 269 |
suite.TearDownSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestNames. = append(suite.TearDownSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestNames., suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().()) |
| 270 |
suite.TearDownSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestRunCount.++ |
| 271 |
} |
| 272 |
|
| 273 |
func (suite *SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) SetupSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTest().() { |
| 274 |
suite.SetupSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestNames. = append(suite.SetupSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestNames., suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().()) |
| 275 |
suite.SetupSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestRunCount.++ |
| 276 |
} |
| 277 |
|
| 278 |
type SuiteSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester# struct { |
| 279 |
// Include our basic suite logic. |
| 280 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#Suite. |
| 281 |
|
| 282 |
// Keep counts of how many times each method is run. |
| 283 |
SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#SetupSuiteRunCount. int |
| 284 |
TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#TearDownSuiteRunCount. int |
| 285 |
} |
| 286 |
|
| 287 |
func (suite *SuiteSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#SetupSuite().() { |
| 288 |
suite.SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#SetupSuiteRunCount.++ |
| 289 |
suite.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Skipscip-go gomod github.com/golang/go/src go1.17 testing/common#Skip().() |
| 290 |
} |
| 291 |
|
| 292 |
func (suite *SuiteSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#) TestNothingscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#TestNothing().() { |
| 293 |
// SetupSuite is only called when at least one test satisfies |
| 294 |
// test filter. For this suite to be set up (and then tore down) |
| 295 |
// it is necessary to add at least one test method. |
| 296 |
} |
| 297 |
|
| 298 |
func (suite *SuiteSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#TearDownSuite().() { |
| 299 |
suite.TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#TearDownSuiteRunCount.++ |
| 300 |
} |
| 301 |
|
| 302 |
// TestRunSuite will be run by the 'go test' command, so within it, we |
| 303 |
// can run our suite using the Run(*testing.T, TestingSuite) function. |
| 304 |
func TestRunSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestRunSuite().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 305 |
suiteTester := new(SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) |
| 306 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suiteTester) |
| 307 |
|
| 308 |
// Normally, the test would end here. The following are simply |
| 309 |
// some assertions to ensure that the Run function is working as |
| 310 |
// intended - they are not part of the example. |
| 311 |
|
| 312 |
// The suite was only run once, so the SetupSuite and TearDownSuite |
| 313 |
// methods should have each been run only once. |
| 314 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteTester.SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSuiteRunCount.) |
| 315 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteTester.TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSuiteRunCount.) |
| 316 |
|
| 317 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Len().(t, suiteTester.SuiteNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameAfter., 4) |
| 318 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Len().(t, suiteTester.SuiteNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameBefore., 4) |
| 319 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Len().(t, suiteTester.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., 4) |
| 320 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Len().(t, suiteTester.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., 4) |
| 321 |
|
| 322 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., "TestOne") |
| 323 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., "TestTwo") |
| 324 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., "TestSkip") |
| 325 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameAfter., "TestSubtest") |
| 326 |
|
| 327 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., "TestOne") |
| 328 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., "TestTwo") |
| 329 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., "TestSkip") |
| 330 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TestNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestNameBefore., "TestSubtest") |
| 331 |
|
| 332 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.SetupSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestNames., "TestRunSuite/TestSubtest/first") |
| 333 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.SetupSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestNames., "TestRunSuite/TestSubtest/second") |
| 334 |
|
| 335 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TearDownSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestNames., "TestRunSuite/TestSubtest/first") |
| 336 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, suiteTester.TearDownSubTestNamesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestNames., "TestRunSuite/TestSubtest/second") |
| 337 |
|
| 338 |
for _, suiteName := range suiteTester.SuiteNameAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameAfter. { |
| 339 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, "SuiteTester", suiteName) |
| 340 |
} |
| 341 |
|
| 342 |
for _, suiteName := range suiteTester.SuiteNameBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SuiteNameBefore. { |
| 343 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, "SuiteTester", suiteName) |
| 344 |
} |
| 345 |
|
| 346 |
for _, when := range suiteTester.TimeAfterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeAfter. { |
| 347 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, when.IsZeroscip-go gomod github.com/golang/go/src go1.17 time/Time#IsZero().()) |
| 348 |
} |
| 349 |
|
| 350 |
for _, when := range suiteTester.TimeBeforescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TimeBefore. { |
| 351 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, when.IsZeroscip-go gomod github.com/golang/go/src go1.17 time/Time#IsZero().()) |
| 352 |
} |
| 353 |
|
| 354 |
// There are four test methods (TestOne, TestTwo, TestSkip, and TestSubtest), so |
| 355 |
// the SetupTest and TearDownTest methods (which should be run once for |
| 356 |
// each test) should have been run four times. |
| 357 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 4, suiteTester.SetupTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupTestRunCount.) |
| 358 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 4, suiteTester.TearDownTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownTestRunCount.) |
| 359 |
|
| 360 |
// Each test should have been run once. |
| 361 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteTester.TestOneRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestOneRunCount.) |
| 362 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteTester.TestTwoRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestTwoRunCount.) |
| 363 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteTester.TestSubtestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TestSubtestRunCount.) |
| 364 |
|
| 365 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 2, suiteTester.TearDownSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#TearDownSubTestRunCount.) |
| 366 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 2, suiteTester.SetupSubTestRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#SetupSubTestRunCount.) |
| 367 |
|
| 368 |
// Methods that don't match the test method identifier shouldn't |
| 369 |
// have been run at all. |
| 370 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 0, suiteTester.NonTestMethodRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#NonTestMethodRunCount.) |
| 371 |
|
| 372 |
suiteSkipTester := new(SuiteSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#) |
| 373 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suiteSkipTester) |
| 374 |
|
| 375 |
// The suite was only run once, so the SetupSuite and TearDownSuite |
| 376 |
// methods should have each been run only once, even though SetupSuite |
| 377 |
// called Skip() |
| 378 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteSkipTester.SetupSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#SetupSuiteRunCount.) |
| 379 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, 1, suiteSkipTester.TearDownSuiteRunCountscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSkipTester#TearDownSuiteRunCount.) |
| 380 |
|
| 381 |
} |
| 382 |
|
| 383 |
// This suite has no Test... methods. It's setup and teardown must be skipped. |
| 384 |
type SuiteSetupSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester# struct { |
| 385 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#Suite. |
| 386 |
|
| 387 |
setUpscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#setUp. bool |
| 388 |
toreDownscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#toreDown. bool |
| 389 |
} |
| 390 |
|
| 391 |
func (s *SuiteSetupSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#SetupSuite().() { |
| 392 |
s.setUpscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#setUp. = true |
| 393 |
} |
| 394 |
|
| 395 |
func (s *SuiteSetupSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#) NonTestMethodscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#NonTestMethod().() { |
| 396 |
|
| 397 |
} |
| 398 |
|
| 399 |
func (s *SuiteSetupSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#TearDownSuite().() { |
| 400 |
s.toreDownscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#toreDown. = true |
| 401 |
} |
| 402 |
|
| 403 |
func TestSkippingSuiteSetupscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSkippingSuiteSetup().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 404 |
suiteTester := new(SuiteSetupSkipTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#) |
| 405 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suiteTester) |
| 406 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, suiteTester.setUpscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#setUp.) |
| 407 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, suiteTester.toreDownscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteSetupSkipTester#toreDown.) |
| 408 |
} |
| 409 |
|
| 410 |
func TestSuiteGettersscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteGetters().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 411 |
suite := new(SuiteTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteTester#) |
| 412 |
suite.SetTscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#SetT().(t) |
| 413 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotNil().(t, suite.Assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Assert().()) |
| 414 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, suite.Assertionsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Assertions., suite.Assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Assert().()) |
| 415 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotNil().(t, suite.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().()) |
| 416 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, suite.requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#require., suite.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().()) |
| 417 |
} |
| 418 |
|
| 419 |
type SuiteLoggingTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester# struct { |
| 420 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#Suite. |
| 421 |
} |
| 422 |
|
| 423 |
func (s *SuiteLoggingTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#) TestLoggingPassscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#TestLoggingPass().() { |
| 424 |
s.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Logscip-go gomod github.com/golang/go/src go1.17 testing/common#Log().("TESTLOGPASS") |
| 425 |
} |
| 426 |
|
| 427 |
func (s *SuiteLoggingTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#) TestLoggingFailscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#TestLoggingFail().() { |
| 428 |
s.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Logscip-go gomod github.com/golang/go/src go1.17 testing/common#Log().("TESTLOGFAIL") |
| 429 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotNil().(s.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().(), nil) // expected to fail |
| 430 |
} |
| 431 |
|
| 432 |
type StdoutCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture# struct { |
| 433 |
oldStdoutscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#oldStdout. *osscip-go gomod github.com/golang/go/src go1.17 os/.Filescip-go gomod github.com/golang/go/src go1.17 os/File# |
| 434 |
readPipescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#readPipe. *osscip-go gomod github.com/golang/go/src go1.17 os/.Filescip-go gomod github.com/golang/go/src go1.17 os/File# |
| 435 |
} |
| 436 |
|
| 437 |
func (sc *StdoutCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#) StartCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#StartCapture().() { |
| 438 |
sc.oldStdoutscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#oldStdout. = osscip-go gomod github.com/golang/go/src go1.17 os/.Stdoutscip-go gomod github.com/golang/go/src go1.17 os/Stdout. |
| 439 |
sc.readPipescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#readPipe., osscip-go gomod github.com/golang/go/src go1.17 os/.Stdoutscip-go gomod github.com/golang/go/src go1.17 os/Stdout., _ = osscip-go gomod github.com/golang/go/src go1.17 os/.Pipescip-go gomod github.com/golang/go/src go1.17 os/Pipe().() |
| 440 |
} |
| 441 |
|
| 442 |
func (sc *StdoutCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#) StopCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#StopCapture().() (string, error) { |
| 443 |
if sc.oldStdoutscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#oldStdout. == nil || sc.readPipescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#readPipe. == nil { |
| 444 |
return "", errorsscip-go gomod github.com/golang/go/src go1.17 errors/.Newscip-go gomod github.com/golang/go/src go1.17 errors/New().("StartCapture not called before StopCapture") |
| 445 |
} |
| 446 |
osscip-go gomod github.com/golang/go/src go1.17 os/.Stdoutscip-go gomod github.com/golang/go/src go1.17 os/Stdout..Closescip-go gomod github.com/golang/go/src go1.17 os/File#Close().() |
| 447 |
osscip-go gomod github.com/golang/go/src go1.17 os/.Stdoutscip-go gomod github.com/golang/go/src go1.17 os/Stdout. = sc.oldStdoutscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#oldStdout. |
| 448 |
bytes, err := ioscip-go gomod github.com/golang/go/src go1.17 io/.ReadAllscip-go gomod github.com/golang/go/src go1.17 io/ReadAll().(sc.readPipescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#readPipe.) |
| 449 |
if err != nil { |
| 450 |
return "", err |
| 451 |
} |
| 452 |
return string(bytes), nil |
| 453 |
} |
| 454 |
|
| 455 |
func TestSuiteLoggingscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteLogging().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 456 |
suiteLoggingTester := new(SuiteLoggingTesterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteLoggingTester#) |
| 457 |
capture := StdoutCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#{} |
| 458 |
internalTest := testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{ |
| 459 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/SuiteLoggingTester", |
| 460 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(subT *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 461 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(subT, suiteLoggingTester) |
| 462 |
}, |
| 463 |
} |
| 464 |
capture.StartCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#StartCapture().() |
| 465 |
testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().(allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., []testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{internalTest}) |
| 466 |
output, err := capture.StopCapturescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/StdoutCapture#StopCapture().() |
| 467 |
requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/NoError().(t, err, "Got an error trying to capture stdout and stderr!") |
| 468 |
requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/NotEmpty().(t, output, "output content must not be empty") |
| 469 |
|
| 470 |
// Failed tests' output is always printed |
| 471 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, output, "TESTLOGFAIL") |
| 472 |
|
| 473 |
if testingscip-go gomod github.com/golang/go/src go1.17 testing/.Verbosescip-go gomod github.com/golang/go/src go1.17 testing/Verbose().() { |
| 474 |
// In verbose mode, output from successful tests is also printed |
| 475 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Contains().(t, output, "TESTLOGPASS") |
| 476 |
} else { |
| 477 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotContains().(t, output, "TESTLOGPASS") |
| 478 |
} |
| 479 |
} |
| 480 |
|
| 481 |
type CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite# struct { |
| 482 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#Suite. |
| 483 |
callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#callOrder. []string |
| 484 |
} |
| 485 |
|
| 486 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().(method string) { |
| 487 |
timescip-go gomod github.com/golang/go/src go1.17 time/.Sleepscip-go gomod github.com/golang/go/src go1.17 time/Sleep().(timescip-go gomod github.com/golang/go/src go1.17 time/.Durationscip-go gomod github.com/golang/go/src go1.17 time/Duration#(randscip-go gomod github.com/golang/go/src go1.17 `math/rand`/.Intnscip-go gomod github.com/golang/go/src go1.17 `math/rand`/Intn().(300)) * timescip-go gomod github.com/golang/go/src go1.17 time/.Millisecondscip-go gomod github.com/golang/go/src go1.17 time/Millisecond.) |
| 488 |
s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#callOrder. = append(s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#callOrder., method) |
| 489 |
} |
| 490 |
|
| 491 |
func TestSuiteCallOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteCallOrder().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 492 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, new(CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#)) |
| 493 |
} |
| 494 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#SetupSuite().() { |
| 495 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SetupSuite") |
| 496 |
} |
| 497 |
|
| 498 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#TearDownSuite().() { |
| 499 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("TearDownSuite") |
| 500 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(s.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().(), "SetupSuite;SetupTest;Test A;SetupSubTest;SubTest A1;TearDownSubTest;SetupSubTest;SubTest A2;TearDownSubTest;TearDownTest;SetupTest;Test B;SetupSubTest;SubTest B1;TearDownSubTest;SetupSubTest;SubTest B2;TearDownSubTest;TearDownTest;TearDownSuite", stringsscip-go gomod github.com/golang/go/src go1.17 strings/.Joinscip-go gomod github.com/golang/go/src go1.17 strings/Join().(s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#callOrder., ";")) |
| 501 |
} |
| 502 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) SetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#SetupTest().() { |
| 503 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SetupTest") |
| 504 |
} |
| 505 |
|
| 506 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) TearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#TearDownTest().() { |
| 507 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("TearDownTest") |
| 508 |
} |
| 509 |
|
| 510 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) SetupSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#SetupSubTest().() { |
| 511 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SetupSubTest") |
| 512 |
} |
| 513 |
|
| 514 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) TearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#TearDownSubTest().() { |
| 515 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("TearDownSubTest") |
| 516 |
} |
| 517 |
|
| 518 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) Test_Ascip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#Test_A().() { |
| 519 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("Test A") |
| 520 |
s.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().("SubTest A1", func() { |
| 521 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SubTest A1") |
| 522 |
}) |
| 523 |
s.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().("SubTest A2", func() { |
| 524 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SubTest A2") |
| 525 |
}) |
| 526 |
} |
| 527 |
|
| 528 |
func (s *CallOrderSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#) Test_Bscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#Test_B().() { |
| 529 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("Test B") |
| 530 |
s.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().("SubTest B1", func() { |
| 531 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SubTest B1") |
| 532 |
}) |
| 533 |
s.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().("SubTest B2", func() { |
| 534 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/CallOrderSuite#call().("SubTest B2") |
| 535 |
}) |
| 536 |
} |
| 537 |
|
| 538 |
type suiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats# struct { |
| 539 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#Suite. |
| 540 |
wasCalledscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#wasCalled. bool |
| 541 |
statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats. *SuiteInformationscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation# |
| 542 |
} |
| 543 |
|
| 544 |
func (s *suiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#) HandleStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#HandleStats().(suiteName string, stats *SuiteInformationscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation#) { |
| 545 |
s.wasCalledscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#wasCalled. = true |
| 546 |
s.statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats. = stats |
| 547 |
} |
| 548 |
|
| 549 |
func (s *suiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#) TestSomethingscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#TestSomething().() { |
| 550 |
s.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#Equal().(1, 1) |
| 551 |
} |
| 552 |
|
| 553 |
func (s *suiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#) TestPanicscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#TestPanic().() { |
| 554 |
panic("oops") |
| 555 |
} |
| 556 |
|
| 557 |
func TestSuiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSuiteWithStats().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 558 |
suiteWithStats := new(suiteWithStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#) |
| 559 |
|
| 560 |
suiteSuccess := testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().(allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., []testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{ |
| 561 |
{ |
| 562 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/suiteWithStats", |
| 563 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 564 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suiteWithStats) |
| 565 |
}, |
| 566 |
}, |
| 567 |
}) |
| 568 |
requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/False().(t, suiteSuccess, "suiteWithStats should report test failure because of panic in TestPanic") |
| 569 |
|
| 570 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/True().(t, suiteWithStats.wasCalledscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#wasCalled.) |
| 571 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, suiteWithStats.statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats..Startscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation#Start.) |
| 572 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, suiteWithStats.statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats..Endscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation#End.) |
| 573 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, suiteWithStats.statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats..Passedscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation#Passed().()) |
| 574 |
|
| 575 |
testStats := suiteWithStats.statsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/suiteWithStats#stats..TestStatsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/SuiteInformation#TestStats. |
| 576 |
|
| 577 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, testStats["TestSomething"].Startscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#Start.) |
| 578 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, testStats["TestSomething"].Endscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#End.) |
| 579 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/True().(t, testStats["TestSomething"].Passedscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#Passed.) |
| 580 |
|
| 581 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, testStats["TestPanic"].Startscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#Start.) |
| 582 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/NotZero().(t, testStats["TestPanic"].Endscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#End.) |
| 583 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, testStats["TestPanic"].Passedscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestInformation#Passed.) |
| 584 |
} |
| 585 |
|
| 586 |
// FailfastSuite will test the behavior when running with the failfast flag |
| 587 |
// It logs calls in the callOrder slice which we then use to assert the correct calls were made |
| 588 |
type FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite# struct { |
| 589 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#Suite. |
| 590 |
callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#callOrder. []string |
| 591 |
} |
| 592 |
|
| 593 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().(method string) { |
| 594 |
s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#callOrder. = append(s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#callOrder., method) |
| 595 |
} |
| 596 |
|
| 597 |
func TestFailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestFailfastSuite().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 598 |
// This test suite is run twice. Once normally and once with the -failfast flag by TestFailfastSuiteFailFastOn |
| 599 |
// If you need to debug it run this test directly with the failfast flag set on/off as you need |
| 600 |
failFast := flagscip-go gomod github.com/golang/go/src go1.17 flag/.Lookupscip-go gomod github.com/golang/go/src go1.17 flag/Lookup().("test.failfast").Valuescip-go gomod github.com/golang/go/src go1.17 flag/Flag#Value..(flagscip-go gomod github.com/golang/go/src go1.17 flag/.Getterscip-go gomod github.com/golang/go/src go1.17 flag/Getter#).Getscip-go gomod github.com/golang/go/src go1.17 flag/Getter#Get().().(bool) |
| 601 |
s := new(FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) |
| 602 |
ok := testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().( |
| 603 |
allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., |
| 604 |
[]testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{{ |
| 605 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/FailfastSuite", |
| 606 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 607 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, s) |
| 608 |
}, |
| 609 |
}}, |
| 610 |
) |
| 611 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, ok) |
| 612 |
var expect []string |
| 613 |
if failFast { |
| 614 |
// Test A Fails and because we are running with failfast Test B never runs and we proceed straight to TearDownSuite |
| 615 |
expect = []string{"SetupSuite", "SetupTest", "Test A Fails", "TearDownTest", "TearDownSuite"} |
| 616 |
} else { |
| 617 |
// Test A Fails and because we are running without failfast we continue and run Test B and then proceed to TearDownSuite |
| 618 |
expect = []string{"SetupSuite", "SetupTest", "Test A Fails", "TearDownTest", "SetupTest", "Test B Passes", "TearDownTest", "TearDownSuite"} |
| 619 |
} |
| 620 |
callOrderAssertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/callOrderAssert().(t, expect, s.callOrderscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#callOrder.) |
| 621 |
} |
| 622 |
|
| 623 |
type tHelperscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/tHelper# interface { |
| 624 |
Helperscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/tHelper#Helper.() |
| 625 |
} |
| 626 |
|
| 627 |
// callOrderAssert is a help with confirms that asserts that expect |
| 628 |
// matches one or more times in callOrder. This makes it compatible |
| 629 |
// with go test flag -count=X where X > 1. |
| 630 |
func callOrderAssertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/callOrderAssert().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#, expect, callOrder []string) { |
| 631 |
var ti interface{} = t |
| 632 |
if h, ok := ti.(tHelperscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/tHelper#); ok { |
| 633 |
h.Helperscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/tHelper#Helper.() |
| 634 |
} |
| 635 |
|
| 636 |
callCount := len(callOrder) |
| 637 |
expectCount := len(expect) |
| 638 |
if callCount > expectCount && callCount%expectCount == 0 { |
| 639 |
// Command line flag -count=X where X > 1. |
| 640 |
for len(callOrder) >= expectCount { |
| 641 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, expect, callOrder[:expectCount]) |
| 642 |
callOrder = callOrder[expectCount:] |
| 643 |
} |
| 644 |
return |
| 645 |
} |
| 646 |
|
| •647 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Equal().(t, expect, callOrder) |
| 648 |
} |
| 649 |
|
| •650 |
func TestFailfastSuiteFailFastOnscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestFailfastSuiteFailFastOn().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 651 |
// To test this with failfast on (and isolated from other intended test failures in our test suite) we launch it in its own process |
| 652 |
cmd := execscip-go gomod github.com/golang/go/src go1.17 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.17 `os/exec`/Command().("go", "test", "-v", "-run", "TestFailfastSuite", "-failfast") |
| 653 |
var out bytesscip-go gomod github.com/golang/go/src go1.17 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.17 bytes/Buffer# |
| 654 |
cmd.Stdoutscip-go gomod github.com/golang/go/src go1.17 `os/exec`/Cmd#Stdout. = &out |
| 655 |
t.Logscip-go gomod github.com/golang/go/src go1.17 testing/common#Log().("Running go test -v -run TestFailfastSuite -failfast") |
| 656 |
err := cmd.Runscip-go gomod github.com/golang/go/src go1.17 `os/exec`/Cmd#Run().() |
| 657 |
t.Logscip-go gomod github.com/golang/go/src go1.17 testing/common#Log().(out.Stringscip-go gomod github.com/golang/go/src go1.17 bytes/Buffer#String().()) |
| 658 |
if err != nil { |
| 659 |
t.Logscip-go gomod github.com/golang/go/src go1.17 testing/common#Log().(err) |
| 660 |
t.Failscip-go gomod github.com/golang/go/src go1.17 testing/common#Fail().() |
| 661 |
} |
| 662 |
} |
| 663 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) SetupSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#SetupSuite().() { |
| 664 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("SetupSuite") |
| 665 |
} |
| 666 |
|
| 667 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#TearDownSuite().() { |
| 668 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("TearDownSuite") |
| 669 |
} |
| 670 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) SetupTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#SetupTest().() { |
| 671 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("SetupTest") |
| 672 |
} |
| 673 |
|
| 674 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) TearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#TearDownTest().() { |
| 675 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("TearDownTest") |
| 676 |
} |
| 677 |
|
| 678 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) Test_A_Failsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#Test_A_Fails().() { |
| 679 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("Test A Fails") |
| 680 |
s.Tscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#T().().Errorscip-go gomod github.com/golang/go/src go1.17 testing/common#Error().("Test A meant to fail") |
| 681 |
} |
| 682 |
|
| 683 |
func (s *FailfastSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#) Test_B_Passesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#Test_B_Passes().() { |
| 684 |
s.callscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/FailfastSuite#call().("Test B Passes") |
| 685 |
s.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().().Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/Assertions#True().(true) |
| 686 |
} |
| 687 |
|
| 688 |
type subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite# struct { |
| 689 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#Suite. |
| 690 |
inTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSuite. bool |
| 691 |
inTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownTest. bool |
| 692 |
inTearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSubTest. bool |
| 693 |
} |
| 694 |
|
| 695 |
func (s *subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#) TearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#TearDownSuite().() { |
| 696 |
s.inTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSuite. = true |
| 697 |
} |
| 698 |
|
| 699 |
func (s *subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#) TearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#TearDownTest().() { |
| 700 |
s.inTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownTest. = true |
| 701 |
} |
| 702 |
|
| 703 |
func (s *subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#) TearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#TearDownSubTest().() { |
| 704 |
s.inTearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSubTest. = true |
| 705 |
} |
| 706 |
|
| 707 |
func (s *subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#) TestSubtestPanicscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#TestSubtestPanic().() { |
| 708 |
ok := s.Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Run().("subtest", func() { |
| 709 |
panic("panic") |
| 710 |
}) |
| 711 |
s.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#False().(ok, "subtest failure is expected") |
| 712 |
} |
| 713 |
|
| 714 |
func TestSubtestPanicscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestSubtestPanic().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 715 |
suite := new(subtestPanicSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#) |
| 716 |
ok := testingscip-go gomod github.com/golang/go/src go1.17 testing/.RunTestsscip-go gomod github.com/golang/go/src go1.17 testing/RunTests().( |
| 717 |
allTestsFilterscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/allTestsFilter()., |
| 718 |
[]testingscip-go gomod github.com/golang/go/src go1.17 testing/.InternalTestscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#{{ |
| 719 |
Namescip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#Name.: t.Namescip-go gomod github.com/golang/go/src go1.17 testing/common#Name().() + "/subtestPanicSuite", |
| 720 |
Fscip-go gomod github.com/golang/go/src go1.17 testing/InternalTest#F.: func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 721 |
Runscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Run().(t, suite) |
| 722 |
}, |
| 723 |
}}, |
| 724 |
) |
| 725 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Falsescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/False().(t, ok, "TestSubtestPanic/subtest should make the testsuite fail") |
| 726 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/True().(t, suite.inTearDownSubTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSubTest.) |
| 727 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/True().(t, suite.inTearDownTestscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownTest.) |
| 728 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/True().(t, suite.inTearDownSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/subtestPanicSuite#inTearDownSuite.) |
| 729 |
} |
| 730 |
|
| 731 |
type unInitializedSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/unInitializedSuite# struct { |
| 732 |
Suitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/unInitializedSuite#Suite. |
| 733 |
} |
| 734 |
|
| 735 |
// TestUnInitializedSuites asserts the behavior of the suite methods when the |
| 736 |
// suite is not initialized |
| 737 |
func TestUnInitializedSuitesscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/TestUnInitializedSuites().(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 738 |
t.Runscip-go gomod github.com/golang/go/src go1.17 testing/T#Run().("should panic on Require", func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 739 |
suite := new(unInitializedSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/unInitializedSuite#) |
| 740 |
|
| 741 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Panicsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Panics().(t, func() { |
| 742 |
suite.Requirescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Require().().Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/require`/Assertions#True().(true) |
| 743 |
}) |
| 744 |
}) |
| 745 |
|
| 746 |
t.Runscip-go gomod github.com/golang/go/src go1.17 testing/T#Run().("should panic on Assert", func(t *testingscip-go gomod github.com/golang/go/src go1.17 testing/.Tscip-go gomod github.com/golang/go/src go1.17 testing/T#) { |
| 747 |
suite := new(unInitializedSuitescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/unInitializedSuite#) |
| 748 |
|
| 749 |
assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/.Panicsscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Panics().(t, func() { |
| 750 |
suite.Assertscip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/suite`/Suite#Assert().().Truescip-go gomod github.com/stretchr/testify . `github.com/stretchr/testify/assert`/Assertions#True().(true) |
| 751 |
}) |
| 752 |
}) |
| 753 |
} |