testing/td/testdata_test.go

38 lines
900 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package testdata_test
import (
"testing"
"strconv"
"strings"
"gitea.rosskeen.house/rosskeen.house/testing/fixture"
"gitea.rosskeen.house/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)
})
}