mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(wildcard): partial match ignoring consumed pattern (#1765)
* tests(wildcard): ? * really? * Franklin * remember when regex was easy * == * why not. * I need an adult. * Update match_test.go * tests + readability * back to basics
This commit is contained in:
parent
2386a9db31
commit
5df6e78d3b
2 changed files with 52 additions and 22 deletions
|
@ -107,6 +107,26 @@ func TestMatch(t *testing.T) {
|
|||
text: "them",
|
||||
matched: false,
|
||||
},
|
||||
{
|
||||
pattern: "t?q*",
|
||||
text: "tam e",
|
||||
matched: false,
|
||||
},
|
||||
{
|
||||
pattern: "Hard?Quiz*",
|
||||
text: "HardX 24 10 12 Ella Reese XXX 1080p MP4-WRB",
|
||||
matched: false,
|
||||
},
|
||||
{
|
||||
pattern: "Hard?Quiz*",
|
||||
text: "HardX",
|
||||
matched: false,
|
||||
},
|
||||
{
|
||||
pattern: "T?Q*",
|
||||
text: "T?Q",
|
||||
matched: true,
|
||||
},
|
||||
}
|
||||
// Iterating over the test cases, call the function under test and assert the output.
|
||||
for i, testCase := range testCases {
|
||||
|
@ -157,6 +177,7 @@ func TestMatchSliceSimple(t *testing.T) {
|
|||
}{
|
||||
{[]string{"*", "test"}, "test", true},
|
||||
{[]string{"te?t", "tost", "random"}, "tost", true},
|
||||
{[]string{"te?t", "t?s?", "random"}, "tost", false},
|
||||
{[]string{"*st", "n?st", "l*st"}, "list", true},
|
||||
{[]string{"?", "?*", "?**"}, "t", false},
|
||||
{[]string{"a", "b", "c"}, "d", false},
|
||||
|
@ -182,6 +203,7 @@ func TestMatchSlice(t *testing.T) {
|
|||
}{
|
||||
{[]string{"*", "test", "t?st"}, "test", true},
|
||||
{[]string{"te?t", "t?st", "random"}, "tost", true},
|
||||
{[]string{"te?t", "t?s?", "random"}, "tost", true},
|
||||
{[]string{"te?t", "t??e?", "random"}, "toser", true},
|
||||
{[]string{"*st", "n?st", "l*st"}, "list", true},
|
||||
{[]string{"?", "??", "???"}, "t", true},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue