diff --git a/pkg/path/pkg.go b/pkg/path/pkg.go index 9cdd35016b6..813242e370b 100644 --- a/pkg/path/pkg.go +++ b/pkg/path/pkg.go @@ -122,6 +122,7 @@ var p = &pkg.Package{ }, { Name: "Match", Params: []pkg.Param{ + {Kind: adt.StringKind}, {Kind: adt.StringKind}, {Kind: adt.StringKind, Value: unixDefault}, }, diff --git a/pkg/path/testdata/os.txtar b/pkg/path/testdata/os.txtar index 6a036d50b28..b92f46d9036 100644 --- a/pkg/path/testdata/os.txtar +++ b/pkg/path/testdata/os.txtar @@ -56,6 +56,15 @@ Clean: [_]: { #"c:\abc\def\..\.."#: _ } +Match: [OS=#AnyOS]: [Pattern=string]: [Name=string]: path.Match(Pattern, Name, OS) +Match: default: [Pattern=string]: [Name=string]: path.Match(Pattern, Name) +Match: default: Match.unix +Match: [_]: { + "*c": "abc": _ + "*.txt": "a/b.txt": _ + "*.zip": #"c:\a\b\file.zip"#: _ +} + Slash: [OS=string]: [ARG=string]: { to: path.ToSlash(ARG, OS) from: path.FromSlash(ARG, OS) @@ -214,6 +223,52 @@ Clean: { "c:\\abc\\def\\..\\..": "c:\\" } } +Match: { + default: { + "*c": { + abc: true + } + "*.txt": { + "a/b.txt": false + } + "*.zip": { + "c:\\a\\b\\file.zip": true + } + } + unix: { + "*c": { + abc: true + } + "*.txt": { + "a/b.txt": false + } + "*.zip": { + "c:\\a\\b\\file.zip": true + } + } + plan9: { + "*c": { + abc: true + } + "*.txt": { + "a/b.txt": false + } + "*.zip": { + "c:\\a\\b\\file.zip": true + } + } + windows: { + "*c": { + abc: true + } + "*.txt": { + "a/b.txt": true + } + "*.zip": { + "c:\\a\\b\\file.zip": false + } + } +} Slash: { unix: { "": {