Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Must ¶
func Must(t FatalReporter, err error, prefix string, args ...interface{})
Must allows the rtx.Must pattern within a unit test and will call t.Fatal if passed a non-nil error. The fatal message is specified as the prefix argument. If any further args are passed, then the prefix will be treated as a format string.
The main purpose of this function is to turn the common pattern of:
err := Func() if err != nil { t.Fatalf("Helpful message (error: %v)", err) }
into a simplified pattern of:
Must(t, Func(), "Helpful message")
This has the benefit of using fewer lines and verifying unit tests are "correct by inspection".
Types ¶
type FatalReporter ¶
type FatalReporter interface { Fatal(args ...interface{}) Helper() }
FatalReporter defines the interface for reporting a fatal test.
Click to show internal directories.
Click to hide internal directories.