File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,55 @@ func TestGetRelativePath(t *testing.T) {
7575 })
7676 }
7777}
78+ func TestGetToolShortName (t * testing.T ) {
79+ tests := []struct {
80+ name string
81+ input string
82+ expected string
83+ }{
84+ {
85+ name : "MappedTool_ESLint8" ,
86+ input : "ESLint" ,
87+ expected : "eslint-8" ,
88+ },
89+ {
90+ name : "MappedTool_PMD7" ,
91+ input : "PMD7" ,
92+ expected : "pmd-7" ,
93+ },
94+ {
95+ name : "MappedTool_Pylint" ,
96+ input : "Pylint" ,
97+ expected : "pylintpython3" ,
98+ },
99+ {
100+ name : "UnmappedTool_Fallback" ,
101+ input : "NewToolName" ,
102+ expected : "NewToolName" ,
103+ },
104+ {
105+ name : "UnmappedTool_AnotherFallback" ,
106+ input : "SomeAnalyzer" ,
107+ expected : "SomeAnalyzer" ,
108+ },
109+ {
110+ name : "EmptyInput_Fallback" ,
111+ input : "" ,
112+ expected : "" ,
113+ },
114+ {
115+ name : "MappedTool_Deprecated" ,
116+ input : "ESLint (deprecated)" ,
117+ expected : "eslint" ,
118+ },
119+ }
120+
121+ for _ , tt := range tests {
122+ t .Run (tt .name , func (t * testing.T ) {
123+ actual := getToolShortName (tt .input )
124+ if actual != tt .expected {
125+ t .Errorf ("getToolShortName(%q) = %q; want %q" , tt .input , actual , tt .expected )
126+ }
127+ })
128+ }
129+ }
You can’t perform that action at this time.
0 commit comments