Use case-insensitive matching for Go license files (#2286)

Signed-off-by: Mark Severson <mark@kasten.io>
This commit is contained in:
Mark Severson
2023-11-03 14:47:09 -04:00
committed by GitHub
parent 2d582f78a1
commit 1470abaded
3 changed files with 223 additions and 3 deletions
@@ -22,6 +22,7 @@ import (
func Test_LocalLicenseSearch(t *testing.T) {
loc1 := file.NewLocation("github.com/someorg/somename@v0.3.2/LICENSE")
loc2 := file.NewLocation("github.com/!cap!o!r!g/!cap!project@v4.111.5/LICENSE.txt")
loc3 := file.NewLocation("github.com/someorg/strangelicense@v1.2.3/LiCeNsE.tXt")
tests := []struct {
name string
@@ -48,6 +49,16 @@ func Test_LocalLicenseSearch(t *testing.T) {
Locations: file.NewLocationSet(loc2),
},
},
{
name: "github.com/someorg/strangelicense",
version: "v1.2.3",
expected: pkg.License{
Value: "Apache-2.0",
SPDXExpression: "Apache-2.0",
Type: license.Concluded,
Locations: file.NewLocationSet(loc3),
},
},
}
wd, err := os.Getwd()