Skip to content

Commit

Permalink
Address service tag regex request in hashicorp#1049
Browse files Browse the repository at this point in the history
  • Loading branch information
gmr authored and eikenb committed Sep 6, 2019
1 parent 47de449 commit 87f0b15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions dependency/catalog_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ func TestNewCatalogServiceQuery(t *testing.T) {
},
false,
},
{
"tag_name_with_colon",
"tag:value.name",
&CatalogServiceQuery{
name: "name",
tag: "tag:value",
},
false,
},
}

for i, tc := range cases {
Expand Down
2 changes: 1 addition & 1 deletion dependency/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
nodeNameRe = `(?P<name>[[:word:]\.\-\_]+)`
nearRe = `(~(?P<near>[[:word:]\.\-\_]+))?`
prefixRe = `/?(?P<prefix>[^@]+)`
tagRe = `((?P<tag>[[:word:]\.\-\_]+)\.)?`
tagRe = `((?P<tag>[[:word:]=:\.\-\_]+)\.)?`
)

type Type int
Expand Down
4 changes: 2 additions & 2 deletions dependency/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ func TestCanShare(t *testing.T) {
func TestDeepCopyAndSortTags(t *testing.T) {
t.Parallel()

tags := []string{"hello", "world", "these", "are", "tags"}
expected := []string{"are", "hello", "tags", "these", "world"}
tags := []string{"hello", "world", "these", "are", "tags", "foo:bar", "baz=qux"}
expected := []string{"are", "baz=qux", "foo:bar", "hello", "tags", "these", "world"}

result := deepCopyAndSortTags(tags)
if !reflect.DeepEqual(result, expected) {
Expand Down

0 comments on commit 87f0b15

Please sign in to comment.