-
Notifications
You must be signed in to change notification settings - Fork 4
/
grammar_test.go
38 lines (29 loc) · 908 Bytes
/
grammar_test.go
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
34
35
36
37
38
package denada
import "testing"
import . "github.com/onsi/gomega"
func Test_QualifierMatch(t *testing.T) {
RegisterTestingT(t)
g := Element{Qualifiers: []string{"set"}, Name: "_", Description: "foo*", definition: false}
i := Element{Qualifiers: []string{"var"}, Name: "x", definition: false}
m := matchQualifiers(&i, &g)
Expect(m).To(Equal(false))
gl := ElementList{&g}
il := ElementList{&i}
ml := Check(il, gl, false)
Expect(ml).ToNot(BeNil())
}
func Test_StringMatch(t *testing.T) {
RegisterTestingT(t)
match := matchString("abc", "abc")
Expect(match).To(BeTrue())
match = matchString("abcabc", "(abc)+")
Expect(match).To(BeTrue())
match = matchString("abc", "_")
Expect(match).To(BeTrue())
match = matchString("abc", ".+")
Expect(match).To(BeTrue())
match = matchString("abc", "def")
Expect(match).To(BeFalse())
match = matchString("_", "abc")
Expect(match).To(BeFalse())
}