mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
feat: new custom linters system (#4437)
This commit is contained in:
parent
f0fdea006f
commit
167204c1fd
31 changed files with 1339 additions and 110 deletions
57
pkg/commands/internal/builder_test.go
Normal file
57
pkg/commands/internal/builder_test.go
Normal file
|
@ -0,0 +1,57 @@
|
|||
package internal
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_sanitizeVersion(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "ampersand",
|
||||
input: " te&st",
|
||||
expected: "test",
|
||||
},
|
||||
{
|
||||
desc: "pipe",
|
||||
input: " te|st",
|
||||
expected: "test",
|
||||
},
|
||||
{
|
||||
desc: "version",
|
||||
input: "v1.2.3",
|
||||
expected: "v1.2.3",
|
||||
},
|
||||
{
|
||||
desc: "branch",
|
||||
input: "feat/test",
|
||||
expected: "feat/test",
|
||||
},
|
||||
{
|
||||
desc: "branch",
|
||||
input: "value --key",
|
||||
expected: "valuekey",
|
||||
},
|
||||
{
|
||||
desc: "hash",
|
||||
input: "cd8b1177",
|
||||
expected: "cd8b1177",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
v := sanitizeVersion(test.input)
|
||||
|
||||
assert.Equal(t, test.expected, v)
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue