platformtest: harness: fix FailNow (harness wouldn't detect FailNow)

(harness checks for recover() != nil)
This commit is contained in:
Christian Schwarz 2019-12-21 15:44:49 +01:00
parent 93ccdb8024
commit e7aa08564b

View File

@ -2,6 +2,7 @@ package platformtest
import ( import (
"context" "context"
"fmt"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -12,6 +13,8 @@ type Context struct {
RootDataset string RootDataset string
} }
var FailNowSentinel = fmt.Errorf("platformtest: FailNow called on context")
var _ assert.TestingT = (*Context)(nil) var _ assert.TestingT = (*Context)(nil)
var _ require.TestingT = (*Context)(nil) var _ require.TestingT = (*Context)(nil)
@ -20,5 +23,5 @@ func (c *Context) Errorf(format string, args ...interface{}) {
} }
func (c *Context) FailNow() { func (c *Context) FailNow() {
panic(nil) panic(FailNowSentinel)
} }