37 lines
901 B
Go
37 lines
901 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
package testdata_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
"gitea.cv.mazarbul.net/rosskeen.house/testing/fixture"
|
||
|
"gitea.cv.mazarbul.net/rosskeen.house/testing/td"
|
||
|
)
|
||
|
|
||
|
func TestTDFixture(t *testing.T) {
|
||
|
r := fixture.R([]fixture.Result{"empty"})
|
||
|
//"./testdat/fixture_TestTDFixture_empty.yml"})
|
||
|
f := fixture.New(t, testdata.FixtureRawFile, testdata.P(t.Name()), r)
|
||
|
|
||
|
f.RunWith(
|
||
|
func (t *testing.T) {
|
||
|
f.Fixture()
|
||
|
f.Assert()
|
||
|
})
|
||
|
|
||
|
}
|
||
|
|
||
|
func TestTDFixtureTypeConversion(t *testing.T) {
|
||
|
c := func(v interface{}) interface{} { i,_ := strconv.Atoi(strings.TrimSuffix(v.(string), "\n")); return i }
|
||
|
r := testdata.Rt(t.Name(), c)
|
||
|
f := fixture.New(t, testdata.FixtureRawFile, testdata.P(t.Name()), r)
|
||
|
|
||
|
f.RunWith(
|
||
|
func (t *testing.T) {
|
||
|
f.Fixture()
|
||
|
f.AssertEq(199)
|
||
|
})
|
||
|
|
||
|
}
|