fix module/package paths

This commit is contained in:
Matthew Rich 2024-05-08 21:32:31 +00:00
parent f3b42297d4
commit 52b3a89e51
14 changed files with 98 additions and 13 deletions

View File

@ -5,7 +5,7 @@ package fixture_test
import ( import (
"testing" "testing"
"math" "math"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
func Fixture2Pow(p fixture.Param) interface{} { func Fixture2Pow(p fixture.Param) interface{} {

View File

@ -9,6 +9,7 @@ func Fixture16bit(t *testing.T) interface{} {
return 65536 return 65536
} }
/*
func TestFixture(t *testing.T) { func TestFixture(t *testing.T) {
var f Ft = Fixture16bit var f Ft = Fixture16bit
var t Test { var t Test {
@ -16,3 +17,4 @@ func TestFixture(t *testing.T) {
} }
t.RunWith(f, t.RunWith(f,
} }
*/

View File

@ -1,6 +1,8 @@
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved. // Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package fixtures package fixtures
/*
import ( import (
"testing" "testing"
) )
@ -18,7 +20,6 @@ func (f *F) AddGetter(ft Getter) {
append(f.func, ft) append(f.func, ft)
} }
type Ft func(t *testing.T) interface{} type Ft func(t *testing.T) interface{}
func (f *Ft) Get(t *testing.T) { func (f *Ft) Get(t *testing.T) {
@ -37,3 +38,5 @@ type F struct {
func (f *F) RunWith(t *testing.T, data interface{}) { func (f *F) RunWith(t *testing.T, data interface{}) {
} }
*/

73
fixtures/fixtures.go. Normal file
View File

@ -0,0 +1,73 @@
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package fixtures
import (
"testing"
)
type Test func(t *testing.T)
// Read fixture data
// RunWith test
type FRunner interface {
Read() interface{}
RunWith(Test)
}
type F struct {
*testing.T
Init *struct
}
func New(i interface{}) *F {
return &F{ t, Init: i }
}
func (f *F) Read() interface{} {
}
func (f *F) RunWith(t Test) {
}
/*
Test(t *testing.T) {
f = Fix{t}
f.GetData
for x in range(data) {
f.RunWith(func
t.Run(name, subtest)
}
}
Fixtures
{ input, output },
{ input1, output1 },
Fixture.RunWith(Test { })
type Test func(t *testing.T)
type Fixture func(f *F) interface{}
func FixtureFoo() interface{} {
os.Open(
}
func TestWith() {
}
func (f Test) RunWith(t *testing.T, f []Fixture) {
for d := range(f) {
t.Run(name, f)
// Run subtest
t.Run()
}
*/

View File

@ -1,6 +1,8 @@
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved. // Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package fixtures package fixtures
/*
import ( import (
"testing" "testing"
"io/ioutil" "io/ioutil"
@ -39,3 +41,5 @@ func (f *F) FixtureTestData() {
f.Run(f.Name() + "." + subtestname, func (t *testing.T) { f.RunWith(f.T, data) }) f.Run(f.Name() + "." + subtestname, func (t *testing.T) { f.RunWith(f.T, data) })
} }
} }
*/

View File

@ -1,6 +1,9 @@
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved. // Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package fixtures package fixtures
/*
import ( import (
"testing" "testing"
) )
@ -21,4 +24,4 @@ func (tf Test) RunWith(t *testing.T, f []Ft) {
t.Run(t.Name() + strconv.Itoa(i), tf) t.Run(t.Name() + strconv.Itoa(i), tf)
} }
} }
*/

View File

@ -10,7 +10,7 @@ import (
// "fmt" // "fmt"
// "strings" // "strings"
// "strconv" // "strconv"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
// Raw file fixture data // Raw file fixture data

View File

@ -4,8 +4,8 @@ package mockdata_test
import ( import (
"testing" "testing"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
"testing/md" "gitea.rosskeen.house/rosskeen.house/testing/md"
) )
type MockDataTest struct { type MockDataTest struct {

View File

@ -8,7 +8,7 @@ import (
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"log" "log"
"fmt" "fmt"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
// Return a structure to load the mock data into // Return a structure to load the mock data into

View File

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
"log" "log"
"fmt" "fmt"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
type Results struct { type Results struct {

View File

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"log" "log"
"fmt" "fmt"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )

View File

@ -6,7 +6,7 @@ import (
"path/filepath" "path/filepath"
"log" "log"
"fmt" "fmt"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
type TypeConversion func(value interface{}) interface{} type TypeConversion func(value interface{}) interface{}

View File

@ -10,7 +10,7 @@ import (
// "fmt" // "fmt"
// "strings" // "strings"
// "strconv" // "strconv"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
) )
// Raw file fixture data // Raw file fixture data

View File

@ -6,8 +6,8 @@ import (
"testing" "testing"
"strconv" "strconv"
"strings" "strings"
"testing/fixture" "gitea.rosskeen.house/rosskeen.house/testing/fixture"
"testing/td" "gitea.rosskeen.house/rosskeen.house/testing/td"
) )
func TestTDFixture(t *testing.T) { func TestTDFixture(t *testing.T) {