forked from TrueCloudLab/restic
filter: fix bug, copy slice with new pattern
This commit is contained in:
parent
e9285539be
commit
b425ea19e5
2 changed files with 23 additions and 2 deletions
|
@ -69,6 +69,8 @@ var matchTests = []struct {
|
|||
{"foo/**/bar/*.go", "bar/main.go", false},
|
||||
{"foo/**/bar", "/home/user/foo/x/y/bar", true},
|
||||
{"foo/**/bar", "/home/user/foo/x/y/bar/main.go", true},
|
||||
{"user/**/important*", "/home/user/work/x/y/hidden/x", false},
|
||||
{"user/**/hidden*/**/c", "/home/user/work/x/y/hidden/z/a/b/c", true},
|
||||
}
|
||||
|
||||
func TestMatch(t *testing.T) {
|
||||
|
@ -268,7 +270,7 @@ var filterTests = []struct {
|
|||
[]string{"accounting.*", "*Partner*"},
|
||||
[]string{"*.docx", "*.xlsx"},
|
||||
[]test{
|
||||
// {"/home/user/foo/test.c", true},
|
||||
{"/home/user/foo/test.c", true},
|
||||
{"/home/user/Partner/test.docx", true},
|
||||
{"/home/user/bar/test.docx", false},
|
||||
{"/home/user/test.xlsx", false},
|
||||
|
@ -279,6 +281,24 @@ var filterTests = []struct {
|
|||
{"/users/A/Calculation Partner.xlsx", true},
|
||||
},
|
||||
},
|
||||
{
|
||||
[]string{"accounting.*", "*Partner*", "user/**/important*"},
|
||||
[]string{"*.docx", "*.xlsx", "user/**/*hidden*"},
|
||||
[]test{
|
||||
{"/home/user/foo/test.c", true},
|
||||
{"/home/user/Partner/test.docx", true},
|
||||
{"/home/user/bar/test.docx", false},
|
||||
{"/home/user/test.xlsx", false},
|
||||
{"/home/foo/test.doc", true},
|
||||
{"/x", true},
|
||||
{"main.go", true},
|
||||
{"/users/A/accounting.xlsx", true},
|
||||
{"/users/A/Calculation Partner.xlsx", true},
|
||||
{"/home/user/work/shared/test/important Calculations/help.txt", true},
|
||||
{"/home/user/work/shared/test/important.xlsx", true},
|
||||
{"/home/user/work/x/y/hidden/x", false},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestFilter(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue