2019-08-20 17:04:13 +02:00
|
|
|
package platformtest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2019-12-21 15:44:49 +01:00
|
|
|
"fmt"
|
2019-08-20 17:04:13 +02:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Context struct {
|
|
|
|
context.Context
|
|
|
|
RootDataset string
|
|
|
|
}
|
|
|
|
|
2019-12-21 15:44:49 +01:00
|
|
|
var FailNowSentinel = fmt.Errorf("platformtest: FailNow called on context")
|
|
|
|
|
2019-12-21 19:01:47 +01:00
|
|
|
var SkipNowSentinel = fmt.Errorf("platformtest: SkipNow called on context")
|
|
|
|
|
2019-08-20 17:04:13 +02:00
|
|
|
var _ assert.TestingT = (*Context)(nil)
|
|
|
|
var _ require.TestingT = (*Context)(nil)
|
|
|
|
|
|
|
|
func (c *Context) Errorf(format string, args ...interface{}) {
|
2019-10-14 17:32:58 +02:00
|
|
|
GetLog(c).Printf(format, args...)
|
2019-08-20 17:04:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Context) FailNow() {
|
2019-12-21 15:44:49 +01:00
|
|
|
panic(FailNowSentinel)
|
2019-08-20 17:04:13 +02:00
|
|
|
}
|
2019-12-21 19:01:47 +01:00
|
|
|
|
|
|
|
func (c *Context) SkipNow() {
|
|
|
|
panic(SkipNowSentinel)
|
|
|
|
}
|