github.com/glycerine/docker@v1.8.2/graph/tags/tags_unit_test.go (about) 1 package tags 2 3 import ( 4 "testing" 5 ) 6 7 func TestValidTagName(t *testing.T) { 8 validTags := []string{"9", "foo", "foo-test", "bar.baz.boo"} 9 for _, tag := range validTags { 10 if err := ValidateTagName(tag); err != nil { 11 t.Errorf("'%s' should've been a valid tag", tag) 12 } 13 } 14 } 15 16 func TestInvalidTagName(t *testing.T) { 17 validTags := []string{"-9", ".foo", "-test", ".", "-"} 18 for _, tag := range validTags { 19 if err := ValidateTagName(tag); err == nil { 20 t.Errorf("'%s' shouldn't have been a valid tag", tag) 21 } 22 } 23 }