Skip to content

Commit 008b91f

Browse files
EE-629 add unit test cases
1 parent 689e6f2 commit 008b91f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

parse_test.go

+32
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,38 @@ func TestParseRule(t *testing.T) {
3030
Owners: []Owner{{Value: "org/team", Type: "team"}},
3131
},
3232
},
33+
{
34+
name: "team owners file with parentheses",
35+
rule: "file(1).txt @org/team",
36+
expected: Rule{
37+
pattern: mustBuildPattern(t, "file(1).txt"),
38+
Owners: []Owner{{Value: "org/team", Type: "team"}},
39+
},
40+
},
41+
{
42+
name: "team owners file with one parentheses on the left",
43+
rule: "file(1.txt @user",
44+
expected: Rule{
45+
pattern: mustBuildPattern(t, "file(1.txt"),
46+
Owners: []Owner{{Value: "user", Type: "username"}},
47+
},
48+
},
49+
{
50+
name: "team owners file with one parentheses on the right",
51+
rule: "file1).txt [email protected]",
52+
expected: Rule{
53+
pattern: mustBuildPattern(t, "file1).txt"),
54+
Owners: []Owner{{Value: "[email protected]", Type: "email"}},
55+
},
56+
},
57+
{
58+
name: "team owners file with parentheses in the folder name",
59+
rule: "(folder)/file.txt @org/team",
60+
expected: Rule{
61+
pattern: mustBuildPattern(t, "(folder)/file.txt"),
62+
Owners: []Owner{{Value: "org/team", Type: "team"}},
63+
},
64+
},
3365
{
3466
name: "email owners",
3567
rule: "file.txt [email protected]",

0 commit comments

Comments
 (0)