github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/dbc/analysis/passes/uniquesignalnames/analyzer_test.go (about) 1 package uniquesignalnames 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 BO_ 101 MOTOR_CMD: 1 DRIVER 17 SG_ MOTOR_CMD_steer : 0|4@1- (1,-5) [-5|5] "" MOTOR 18 SG_ MOTOR_CMD_drive : 4|4@1+ (1,0) [0|9] "" MOTOR 19 `, 20 }, 21 22 { 23 Name: "duplicate", 24 Data: ` 25 BO_ 101 MOTOR_CMD: 1 DRIVER 26 SG_ MOTOR_CMD_steer : 0|4@1- (1,-5) [-5|5] "" MOTOR 27 SG_ MOTOR_CMD_steer : 4|4@1+ (1,0) [0|9] "" MOTOR 28 `, 29 Diagnostics: []*analysis.Diagnostic{ 30 { 31 Pos: scanner.Position{Line: 3, Column: 2}, 32 Message: "non-unique signal name", 33 }, 34 }, 35 }, 36 }) 37 }