Skip to content

EE-629 fix fork parsing ( ) bug #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func isAlphanumeric(ch rune) bool {
// isPatternChar matches characters that are allowed in patterns
func isPatternChar(ch rune) bool {
switch ch {
case '*', '?', '.', '/', '@', '_', '+', '-', '\\':
case '*', '?', '.', '/', '@', '_', '+', '-', '\\', '(', ')':
return true
}
return isAlphanumeric(ch)
Expand Down
32 changes: 32 additions & 0 deletions parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,38 @@ func TestParseRule(t *testing.T) {
Owners: []Owner{{Value: "org/team", Type: "team"}},
},
},
{
name: "team owners file with parentheses",
rule: "file(1).txt @org/team",
expected: Rule{
pattern: mustBuildPattern(t, "file(1).txt"),
Owners: []Owner{{Value: "org/team", Type: "team"}},
},
},
{
name: "team owners file with one parentheses on the left",
rule: "file(1.txt @user",
expected: Rule{
pattern: mustBuildPattern(t, "file(1.txt"),
Owners: []Owner{{Value: "user", Type: "username"}},
},
},
{
name: "team owners file with one parentheses on the right",
rule: "file1).txt [email protected]",
expected: Rule{
pattern: mustBuildPattern(t, "file1).txt"),
Owners: []Owner{{Value: "[email protected]", Type: "email"}},
},
},
{
name: "team owners file with parentheses in the folder name",
rule: "(folder)/file.txt @org/team",
expected: Rule{
pattern: mustBuildPattern(t, "(folder)/file.txt"),
Owners: []Owner{{Value: "org/team", Type: "team"}},
},
},
{
name: "email owners",
rule: "file.txt [email protected]",
Expand Down
Loading