github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/dbc/analysis/passes/requireddefinitions/analyzer_test.go (about) 1 package requireddefinitions 2 3 import ( 4 "testing" 5 "text/scanner" 6 7 "github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis" 8 "github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis/analysistest" 9 ) 10 11 func TestAnalyzer(t *testing.T) { 12 analysistest.Run(t, Analyzer(), []*analysistest.Case{ 13 { 14 Name: "ok", 15 Data: ` 16 BS_: 17 BU_: ECU1 18 `, 19 }, 20 21 { 22 Name: "missing bit timing", 23 Data: ` 24 BU_: ECU1 25 `, 26 Diagnostics: []*analysis.Diagnostic{ 27 { 28 Pos: scanner.Position{Line: 1, Column: 1}, 29 Message: "missing required definition(s)", 30 }, 31 }, 32 }, 33 34 { 35 Name: "missing nodes", 36 Data: ` 37 BS_: 38 `, 39 Diagnostics: []*analysis.Diagnostic{ 40 { 41 Pos: scanner.Position{Line: 1, Column: 1}, 42 Message: "missing required definition(s)", 43 }, 44 }, 45 }, 46 }) 47 }