feat: new custom linters system (#4437)

This commit is contained in:
Ludovic Fernandez 2024-03-11 17:40:26 +01:00 committed by GitHub
parent f0fdea006f
commit 167204c1fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 1339 additions and 110 deletions

View 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)
})
}
}