tests: Convert from testify to quicktest

This commit is contained in:
Bjørn Erik Pedersen
2019-08-10 21:05:17 +02:00
parent 6027ee1108
commit 9e57182705
195 changed files with 3919 additions and 3693 deletions

View File

@@ -1,19 +1,18 @@
package inflect
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
qt "github.com/frankban/quicktest"
)
func TestInflect(t *testing.T) {
t.Parallel()
c := qt.New(t)
ns := New()
for i, test := range []struct {
for _, test := range []struct {
fn func(i interface{}) (string, error)
in interface{}
expect interface{}
@@ -34,16 +33,15 @@ func TestInflect(t *testing.T) {
{ns.Singularize, "", ""},
{ns.Singularize, t, false},
} {
errMsg := fmt.Sprintf("[%d] %v", i, test)
result, err := test.fn(test.in)
if b, ok := test.expect.(bool); ok && !b {
require.Error(t, err, errMsg)
c.Assert(err, qt.Not(qt.IsNil))
continue
}
require.NoError(t, err, errMsg)
assert.Equal(t, test.expect, result, errMsg)
c.Assert(err, qt.IsNil)
c.Assert(result, qt.Equals, test.expect)
}
}