github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/transform/startf/qri/qri_test.go (about) 1 package qri 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/qri-io/dataset" 8 "go.starlark.net/starlark" 9 ) 10 11 func TestNewModule(t *testing.T) { 12 t.Skip("TODO (b5): restore") 13 14 ds := &dataset.Dataset{ 15 Transform: &dataset.Transform{ 16 Syntax: "starlark", 17 Config: map[string]interface{}{ 18 "foo": "bar", 19 }, 20 }, 21 } 22 23 thread := &starlark.Thread{Load: newLoader(ds)} 24 25 // Execute test file 26 _, err := starlark.ExecFile(thread, "testdata/test.star", nil, nil) 27 if err != nil { 28 t.Error(err) 29 } 30 } 31 32 // load implements the 'load' operation as used in the evaluator tests. 33 func newLoader(ds *dataset.Dataset) func(thread *starlark.Thread, module string) (starlark.StringDict, error) { 34 return func(thread *starlark.Thread, module string) (starlark.StringDict, error) { 35 if module == ModuleName { 36 return starlark.StringDict{"qri": NewModule(nil).Struct()}, nil 37 } 38 39 return nil, fmt.Errorf("invalid module") 40 } 41 }