fix: java archives excluded due to incorrect license glob results (#4449)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow
2025-12-08 15:58:13 -05:00
committed by GitHub
parent d950ac1fae
commit 9e3150b7ee
10 changed files with 47 additions and 128 deletions
+14 -12
View File
@@ -9,6 +9,8 @@ import (
"os"
"path"
"testing"
"github.com/stretchr/testify/require"
)
func TestNewZipFileManifest(t *testing.T) {
@@ -107,23 +109,27 @@ func TestZipFileManifest_GlobMatch(t *testing.T) {
cases := []struct {
glob string
expected string
expected []string
}{
{
"/b*",
"b-file.txt",
[]string{"b-file.txt"},
},
{
"*/a-file.txt",
"some-dir/a-file.txt",
"/b*/**",
[]string{"b-file.txt", "b-file/in-subdir.txt"},
},
{
"*/A-file.txt",
"some-dir/a-file.txt",
"**/a-file.txt",
[]string{"some-dir/a-file.txt"},
},
{
"**/A-file.txt",
[]string{"some-dir/a-file.txt"},
},
{
"**/*.zip",
"nested.zip",
[]string{"nested.zip"},
},
}
@@ -133,11 +139,7 @@ func TestZipFileManifest_GlobMatch(t *testing.T) {
results := z.GlobMatch(true, glob)
if len(results) == 1 && results[0] == tc.expected {
return
}
t.Errorf("unexpected results for glob '%s': %+v", glob, results)
require.ElementsMatch(t, tc.expected, results)
})
}
}