1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
package names
import (
"strings"
gc "gopkg.in/check.v1"
)
var snippets = []struct {
name string
snippet string
}{
{"ContainerTypeSnippet", ContainerTypeSnippet},
{"ContainerSnippet", ContainerSnippet},
{"MachineSnippet", MachineSnippet},
{"NumberSnippet", NumberSnippet},
{"ApplicationSnippet", ApplicationSnippet},
{"RelationSnippet", RelationSnippet},
}
type snippetSuite struct{}
var _ = gc.Suite(&snippetSuite{})
func (s *equalitySuite) TestSnippetsContainNoCapturingGroups(c *gc.C) {
for _, test := range snippets {
for i, ch := range test.snippet {
if ch == '(' && !strings.HasPrefix(test.snippet[i:], "(?:") {
c.Errorf("%s (%q) contains capturing group", test.name, test.snippet)
}
}
}
}
|