Added space support + tests

This commit is contained in:
Ice3man543 2021-02-05 15:20:01 +05:30
parent fbf5be544f
commit b485c9407f
2 changed files with 6 additions and 0 deletions

View File

@ -168,6 +168,7 @@ mainLoop:
for _, t := range options.Tags {
commaTags := strings.Split(t, ",")
for _, tag := range commaTags {
tag = strings.TrimSpace(tag)
key, value := getKeyValue(tag)
for _, templTag := range actualTags {

View File

@ -24,4 +24,9 @@ func TestMatchTemplateWithTags(t *testing.T) {
err = matchTemplateWithTags("lang:php, os:linux, cms:symfony", &types.Options{Tags: []string{"cms:symfony"}})
require.Nil(t, err, "could get key value tag from input key value with space")
})
t.Run("comma-tags", func(t *testing.T) {
err = matchTemplateWithTags("lang:php,os:linux,cms:symfony", &types.Options{Tags: []string{"test,cms:symfony"}})
require.Nil(t, err, "could get key value tag from input key value with comma")
})
}