testing/td/testdata_test.go

38 lines
900 B
Go
Raw Normal View History

2024-05-08 20:28:36 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
2024-05-08 21:08:10 +00:00
2024-05-08 20:28:36 +00:00
package testdata_test
import (
"testing"
"strconv"
"strings"
2024-05-08 21:32:31 +00:00
"gitea.rosskeen.house/rosskeen.house/testing/fixture"
"gitea.rosskeen.house/rosskeen.house/testing/td"
2024-05-08 20:28:36 +00:00
)
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)
})
}