// runTest runs a single test, returning a slice of failure records for that test.
runTest runs a single test, returning a slice of failure records for that test.
// runTest runs a single test returning a slice of failure records for that test .
func runTest(suite interface{}, method reflect.Method) (failures []*failureRecord) {
	suiteValue := reflect.ValueOf(suite)
	suiteType := suiteValue.Type()
	currentlyRunningTest = newTestInfo()
	defer func() {
		currentlyRunningTest = nil
	}()
	suiteInstance := reflect.New(suiteType.Elem())
	setUpPanicked := runWithProtection(
		func() {
			runMethodIfExists(suiteInstance, "SetUp", currentlyRunningTest)
		},
	)
	if !setUpPanicked {
		runWithProtection(
			func() {
				runMethodIfExists(suiteInstance, method.Name)
			},
		)
	}
	runWithProtection(
		func() {
			runMethodIfExists(suiteInstance, "TearDown")
		},
	)
	currentlyRunningTest.MockController.Finish()
	return currentlyRunningTest.failureRecords
}
func runTest ( suite interface { } , method reflect . Method ) ( failures [ ] * failureRecord ) { suiteValue := reflect . ValueOf ( suite ) suiteType := suiteValue . Type ( ) currentlyRunningTest = newTestInfo ( ) defer func ( ) { currentlyRunningTest = nil } ( ) suiteInstance := reflect . New ( suiteType . Elem ( ) ) setUpPanicked := runWithProtection ( func ( ) { runMethodIfExists ( suiteInstance , " " , currentlyRunningTest ) } , ) if ! setUpPanicked { runWithProtection ( func ( ) { runMethodIfExists ( suiteInstance , method . Name ) } , ) } runWithProtection ( func ( ) { runMethodIfExists ( suiteInstance , " " ) } , ) currentlyRunningTest . MockController . Finish ( ) return currentlyRunningTest . failureRecords }
runTest runs a single test, returning a slice of failure records for that test.
runTest runs a single test returning a slice of failure records for that test .
// Set up a clean slate for this test. Make sure to reset it after everything // below is finished, so we don't accidentally use it elsewhere. // Create a receiver. // Run the SetUp method, paying attention to whether it panics. // Run the test method itself, but only if the SetUp method didn't panic. // (This includes AssertThat errors.) // Run the TearDown method unconditionally. // Tell the mock controller for the tests to report any errors it's sitting // on.