github.com/alkemics/goflow@v0.2.1/checkers/unused/check_test.go (about) 1 package unused_test 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 8 "github.com/alkemics/goflow" 9 "github.com/alkemics/goflow/checkers/unused" 10 "github.com/alkemics/goflow/gfutil/gfgo" 11 "github.com/alkemics/goflow/wrappers/after" 12 "github.com/alkemics/goflow/wrappers/bind" 13 "github.com/alkemics/goflow/wrappers/gonodes" 14 "github.com/alkemics/goflow/wrappers/outputs" 15 "github.com/alkemics/goflow/wrappers/varnames" 16 ) 17 18 func TestUnused(t *testing.T) { 19 require := require.New(t) 20 21 var loader gfgo.NodeLoader 22 err := loader.Load("github.com/alkemics/goflow/example/nodes") 23 require.NoError(err) 24 25 wrappers := []goflow.GraphWrapper{ 26 gonodes.Wrapper(&loader), 27 bind.Wrapper, 28 outputs.Wrapper, 29 varnames.Wrapper, 30 outputs.NameWrapper, 31 goflow.FromNodeWrapper(after.Wrapper), 32 varnames.CompilableWrapper, 33 } 34 checkers := []goflow.Checker{ 35 unused.Check, 36 } 37 require.NoError(gfgo.TestCheck(t, wrappers, checkers, "ok.yml")) 38 require.Error(gfgo.TestCheck(t, wrappers, checkers, "ko.yml")) 39 }