35 lines
681 B
Go
35 lines
681 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
package mockdata_test
|
|
|
|
import (
|
|
"testing"
|
|
"testing/fixture"
|
|
"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")
|
|
}
|
|
})
|
|
|
|
}
|