refactored

This commit is contained in:
Aine
2022-08-29 12:30:43 +03:00
parent 79775c0c13
commit 6623251695
7 changed files with 114 additions and 112 deletions

View File

@@ -7,7 +7,7 @@ import (
)
// WildcardMXIDsToRegexes converts a list of wildcard patterns to a list of regular expressions
func WildcardMXIDsToRegexes(wildCardPatterns []string) (*[]*regexp.Regexp, error) {
func WildcardMXIDsToRegexes(wildCardPatterns []string) ([]*regexp.Regexp, error) {
regexPatterns := make([]*regexp.Regexp, len(wildCardPatterns))
for idx, wildCardPattern := range wildCardPatterns {
@@ -18,7 +18,7 @@ func WildcardMXIDsToRegexes(wildCardPatterns []string) (*[]*regexp.Regexp, error
regexPatterns[idx] = regex
}
return &regexPatterns, nil
return regexPatterns, nil
}
// Match tells if the given user id is allowed to use the bot, according to the given whitelist

View File

@@ -202,7 +202,7 @@ func TestMatch(t *testing.T) {
t.Error(err)
}
actualResult := Match(testData.checkedValue, *allowedUserRegexes)
actualResult := Match(testData.checkedValue, allowedUserRegexes)
if actualResult == testData.expectedResult {
return