zrepl/platformtest/platformtest.go
Christian Schwarz e7aa08564b platformtest: harness: fix FailNow (harness wouldn't detect FailNow)
(harness checks for recover() != nil)
2020-02-14 21:40:48 +01:00

28 lines
508 B
Go

package platformtest
import (
"context"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type Context struct {
context.Context
RootDataset string
}
var FailNowSentinel = fmt.Errorf("platformtest: FailNow called on context")
var _ assert.TestingT = (*Context)(nil)
var _ require.TestingT = (*Context)(nil)
func (c *Context) Errorf(format string, args ...interface{}) {
GetLog(c).Printf(format, args...)
}
func (c *Context) FailNow() {
panic(FailNowSentinel)
}