func assert(t *testing.T, wantError, wantFatal string, f func(m *mock)) {
	t.Helper()

	defer func() {
		if v := recover(); v != nil {
			if err, ok := v.(error); ok && errors.Is(err, errFailed) {
				return // execution of the goroutine is stopped by a mock Fatal function
			}
			t.Fatalf("panic: %v", v)
		}
	}()

	m := &mock{
		wantError: wantError,
		wantFatal: wantFatal,
	}

	f(m)

	if !m.isHelper { // Request function is tested and it must be always a helper
		t.Error("not a helper function")
	}

	if m.gotError != m.wantError {
		t.Errorf("got error %q, want %q", m.gotError, m.wantError)
	}

	if m.gotFatal != m.wantFatal {
		t.Errorf("got error %v, want %v", m.gotFatal, m.wantFatal)
	}
}
// assert is a test helper that validates a functionality of another helper
// function by mocking Errorf, Fatal and Helper methods on testing.TB.
assert is a test helper that validates a functionality of another helper
function by mocking Errorf, Fatal and Helper methods on testing.TB.
// assert is a test helper that validates a functionality of another helper // function by mocking Errorf Fatal and Helper methods on testing . TB .
func assert(t *testing.T, wantError, wantFatal string, f func(m *mock)) {
	t.Helper()
	defer func() {
		if v := recover(); v != nil {
			if err, ok := v.(error); ok && errors.Is(err, errFailed) {
				return 
			}
			t.Fatalf("panic: %v", v)
		}
	}()
	m := &mock{
		wantError: wantError,
		wantFatal: wantFatal,
	}
	f(m)
	if !m.isHelper { 
		t.Error("not a helper function")
	}
	if m.gotError != m.wantError {
		t.Errorf("got error %q, want %q", m.gotError, m.wantError)
	}
	if m.gotFatal != m.wantFatal {
		t.Errorf("got error %v, want %v", m.gotFatal, m.wantFatal)
	}
}
func assert ( t * testing . T , wantError , wantFatal string , f func ( m * mock ) ) { t . Helper ( ) defer func ( ) { if v := recover ( ) ; v != nil { if err , ok := v . ( error ) ; ok && errors . Is ( err , errFailed ) { return } t . Fatalf ( " " , v ) } } ( ) m := & mock { wantError : wantError , wantFatal : wantFatal , } f ( m ) if ! m . isHelper { t . Error ( " " ) } if m . gotError != m . wantError { t . Errorf ( " " , m . gotError , m . wantError ) } if m . gotFatal != m . wantFatal { t . Errorf ( " " , m . gotFatal , m . wantFatal ) } }
assert is a test helper that validates a functionality of another helper
function by mocking Errorf, Fatal and Helper methods on testing.TB.
assert is a test helper that validates a functionality of another helper function by mocking Errorf Fatal and Helper methods on testing . TB .
// execution of the goroutine is stopped by a mock Fatal function // Request function is tested and it must be always a helper