blob: 2a2318ce9c645014d672f70fb53ba40d32a204ba [file] [log] [blame]
package fxtesting
import (
"testing"
)
// T wraps a testing.T to add Fuchsia-specific test functionality.
// Example Usage:
// t.Run("a_test", func(t *testing.T) {
// fxt := T{t}
// fxt.AssertNil(MaybeError())
// })
type T struct {
*testing.T
}
// AssertNil raises a fatal error if the error is not nil.
func (t *T) AssertNil(err error) {
if err != nil {
t.Fatal(err)
}
}
// Assert raises a fatal error with the given message if a condition is not met. A single
// string message is required at minimum to aid in debugging test failures.
func (t *T) Assert(condition bool, format string, args ...interface{}) {
if !condition {
t.Fatalf(format, args...)
}
}