1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-10 08:36:10 +02:00

test: added test case for #469

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos A Becker 2022-03-01 20:10:24 -03:00
parent 4a49bb986b
commit b2be4a9b8e
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -310,3 +310,40 @@ func TestDisableGlobbing(t *testing.T) {
})
}
}
func TestGlobbingWhenFilesHaveBrackets(t *testing.T) {
result, err := files.ExpandContentGlobs(files.Contents{
{
Source: "./testdata/\\{test\\}/",
Destination: ".",
},
}, false)
if err != nil {
t.Fatalf("expand content globs: %v", err)
}
expected := files.Contents{
{
Source: "testdata/{test}/[f]oo",
Destination: "[f]oo",
},
{
Source: "testdata/{test}/bar",
Destination: "bar",
},
}
if len(result) != 2 {
t.Fatalf("unexpected result length: %d, expected one", len(result))
}
for i, r := range result {
ex := expected[i]
if ex.Source != r.Source {
t.Fatalf("unexpected content source: %q, expected %q", r.Source, ex.Source)
}
if ex.Destination != r.Destination {
t.Fatalf("unexpected content destination: %q, expected %q", r.Destination, ex.Destination)
}
}
}