github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/dbc/analysis/passes/valuedescriptions/analyzer_test.go (about) 1 package valuedescriptions 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: `VAL_ 100 Command 2 "Reboot" 1 "Sync" 0 "Noop";`, 16 }, 17 { 18 Name: "ok", 19 Data: `VAL_ 100 Command 2 "11Reboot" 1 "123" 0 "Noop";`, 20 }, 21 { 22 Name: "underscore", 23 Data: `VAL_ 100 Command 2 "Reboot_Command" 1 "Sync" 0 "Noop";`, 24 Diagnostics: []*analysis.Diagnostic{ 25 { 26 Pos: scanner.Position{Line: 1, Column: 21}, 27 Message: "value description must be CamelCase (numbers ignored)", 28 }, 29 }, 30 }, 31 { 32 Name: "several digits value", 33 Data: `VAL_ 100 Command 234 "Reboot_Command" 1 "Sync" 0 "Noop";`, 34 Diagnostics: []*analysis.Diagnostic{ 35 { 36 Pos: scanner.Position{Line: 1, Column: 23}, 37 Message: "value description must be CamelCase (numbers ignored)", 38 }, 39 }, 40 }, 41 }) 42 }