Documentation ¶
Overview ¶
Package testlib provides utilities for testing
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoesPanic ¶
func DoesPanic(f func()) (panicked bool, recovered interface{})
DoesPanic runs f and checks if it panicked or not. When f does panic, returns the recovered value.
Example (Normal) ¶
DoesPanic behavior for a function that does not panic
didPanic, _ := DoesPanic(func() { /* do nothing */ }) fmt.Printf("didPanic = %t\n", didPanic)
Output: didPanic = false
Example (Panic) ¶
DoesPanic behavior for a panicking function
didPanic, recovered := DoesPanic(func() { panic("some error message") }) fmt.Printf("didPanic = %t\n", didPanic) fmt.Printf("recover() = %v\n", recovered)
Output: didPanic = true recover() = some error message
func TempDirAbs ¶
TempDirAbs is like the TempDir method of t, but resolves all symlinks in the returned path.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.