| 1 | package editorconfigscip-go gomod github.com/editorconfig/editorconfig-core-go/v2 . `github.com/editorconfig/editorconfig-core-go/v2`/ //nolint:testpackage |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/" |
| 5 | ) |
| 6 | |
| 7 | func TestTranslatescip-go gomod github.com/editorconfig/editorconfig-core-go/v2 . `github.com/editorconfig/editorconfig-core-go/v2`/TestTranslate().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 8 | t.Parallelscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Parallel().() |
| 9 | |
| 10 | tests := []struct { |
| 11 | pattern string |
| 12 | expected string |
| 13 | }{ |
| 14 | {"a*e.c", `a[^/]*e\.c`}, |
| 15 | {"a**z.c", `a.*z\.c`}, |
| 16 | {"d/**/z.c", `d(?:/|/.*/)z\.c`}, |
| 17 | {"som?.c", `som[^/]\.c`}, |
| 18 | {"[\\]ab].g", `[\]ab]\.g`}, |
| 19 | {"[ab]].g", `[ab]]\.g`}, |
| 20 | {"ab[/c", `ab\[/c`}, |
| 21 | {"*.{py,js,html}", `[^/]*\.(?:py|js|html)`}, |
| 22 | {"{single}.b", `\{single\}\.b`}, |
| 23 | {"{{,b,c{d}.i", `\{\{,b,c\{d\}\.i`}, |
| 24 | {"{a\\,b,cd}", `(?:a,b|cd)`}, |
| 25 | {"{e,\\},f}", `(?:e|}|f)`}, |
| 26 | {"{a,{b,c}}", `(?:a|(?:b|c))`}, |
| 27 | {"{{a,b},c}", `(?:(?:a|b)|c)`}, |
| 28 | } |
| 29 | |
| 30 | for _, test := range tests { |
| 31 | t.Runscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Run().(test.pattern, func(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 32 | t.Parallelscip-go gomod github.com/golang/go/src go1.24.0 testing/T#Parallel().() |
| 33 | |
| 34 | result := translatescip-go gomod github.com/editorconfig/editorconfig-core-go/v2 . `github.com/editorconfig/editorconfig-core-go/v2`/translate().(test.pattern) |
| 35 | if result != test.expected { |
| 36 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("%s != %s", test.expected, result) |
| 37 | } |
| 38 | }) |
| 39 | } |
| 40 | } |