testing/md/mockdata_test.go

35 lines
753 B
Go
Raw Permalink 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 mockdata_test
import (
"testing"
2024-05-08 21:32:31 +00:00
"gitea.rosskeen.house/rosskeen.house/testing/fixture"
"gitea.rosskeen.house/rosskeen.house/testing/md"
2024-05-08 20:28:36 +00:00
)
type MockDataTest struct {
foo int
bar int
}
func NewMock() interface{} {
return &MockDataTest{}
}
func TestMDFixture(t *testing.T) {
//r := fixture.R([]fixture.Result{"empty"})
//"./testdat/fixture_TestTDFixture_empty.yml"})
f := fixture.New(t, mockdata.FixtureMockFile, mockdata.P(t.Name(), NewMock), nil)
f.RunWith(
func (t *testing.T) {
o := f.Value()
var d *MockDataTest = o.(*MockDataTest)
if d.foo != 3 {
t.Errorf("Failed to load mock object")
}
})
}