testing/md/mockdata_test.go

34 lines
754 B
Go

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