Adding upstream version 2.6.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
4d8cd0ce4c
commit
2b08a89310
39 changed files with 2140 additions and 0 deletions
40
fnmatch_test.go
Normal file
40
fnmatch_test.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package editorconfig //nolint:testpackage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTranslate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
pattern string
|
||||
expected string
|
||||
}{
|
||||
{"a*e.c", `a[^/]*e\.c`},
|
||||
{"a**z.c", `a.*z\.c`},
|
||||
{"d/**/z.c", `d(?:/|/.*/)z\.c`},
|
||||
{"som?.c", `som[^/]\.c`},
|
||||
{"[\\]ab].g", `[\]ab]\.g`},
|
||||
{"[ab]].g", `[ab]]\.g`},
|
||||
{"ab[/c", `ab\[/c`},
|
||||
{"*.{py,js,html}", `[^/]*\.(?:py|js|html)`},
|
||||
{"{single}.b", `\{single\}\.b`},
|
||||
{"{{,b,c{d}.i", `\{\{,b,c\{d\}\.i`},
|
||||
{"{a\\,b,cd}", `(?:a,b|cd)`},
|
||||
{"{e,\\},f}", `(?:e|}|f)`},
|
||||
{"{a,{b,c}}", `(?:a|(?:b|c))`},
|
||||
{"{{a,b},c}", `(?:(?:a|b)|c)`},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.pattern, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
result := translate(test.pattern)
|
||||
if result != test.expected {
|
||||
t.Errorf("%s != %s", test.expected, result)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue