Skip to content

Commit

Permalink
chore: test cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Phillips <[email protected]>
  • Loading branch information
spiffcs committed Jul 11, 2023
1 parent 95f59a5 commit ef05a45
Show file tree
Hide file tree
Showing 4 changed files with 1,240 additions and 1,185 deletions.
27 changes: 27 additions & 0 deletions internal/spdxlicense/generate/generate_license_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,23 @@ func Test_processSPDXLicense(t *testing.T) {
"afl3.0.0": "AFL-3.0",
"afmparse": "Afmparse",
"agpl1": "AGPL-1.0-only",
"agpl1+": "AGPL-1.0-or-later",
"agpl1.0": "AGPL-1.0-only",
"agpl1.0+": "AGPL-1.0-or-later",
"agpl1.0.0": "AGPL-1.0-only",
"agpl1.0.0+": "AGPL-1.0-or-later",
"agpl1.0.0only": "AGPL-1.0-only",
"agpl1.0.0orlater": "AGPL-1.0-or-later",
"agpl1.0only": "AGPL-1.0-only",
"agpl1.0orlater": "AGPL-1.0-or-later",
"agpl1only": "AGPL-1.0-only",
"agpl1orlater": "AGPL-1.0-or-later",
"agpl3": "AGPL-3.0-only",
"agpl3+": "AGPL-3.0-or-later",
"agpl3.0": "AGPL-3.0-only",
"agpl3.0+": "AGPL-3.0-or-later",
"agpl3.0.0": "AGPL-3.0-only",
"agpl3.0.0+": "AGPL-3.0-or-later",
"agpl3.0.0only": "AGPL-3.0-only",
"agpl3.0.0orlater": "AGPL-3.0-or-later",
"agpl3.0only": "AGPL-3.0-only",
Expand Down Expand Up @@ -548,8 +554,17 @@ func Test_processSPDXLicense(t *testing.T) {
"ftl": "FTL",
"gd": "GD",
"gfdl1": "GFDL-1.1-only",
"gfdl1+": "GFDL-1.1-or-later",
"gfdl1+invariants": "GFDL-1.1-invariants-or-later",
"gfdl1+noinvariants": "GFDL-1.1-no-invariants-or-later",
"gfdl1.1": "GFDL-1.1-only",
"gfdl1.1+": "GFDL-1.1-or-later",
"gfdl1.1+invariants": "GFDL-1.1-invariants-or-later",
"gfdl1.1+noinvariants": "GFDL-1.1-no-invariants-or-later",
"gfdl1.1.0": "GFDL-1.1-only",
"gfdl1.1.0+": "GFDL-1.1-or-later",
"gfdl1.1.0+invariants": "GFDL-1.1-invariants-or-later",
"gfdl1.1.0+noinvariants": "GFDL-1.1-no-invariants-or-later",
"gfdl1.1.0invariantsonly": "GFDL-1.1-invariants-only",
"gfdl1.1.0invariantsorlater": "GFDL-1.1-invariants-or-later",
"gfdl1.1.0noinvariantsonly": "GFDL-1.1-no-invariants-only",
Expand All @@ -563,7 +578,13 @@ func Test_processSPDXLicense(t *testing.T) {
"gfdl1.1only": "GFDL-1.1-only",
"gfdl1.1orlater": "GFDL-1.1-or-later",
"gfdl1.2": "GFDL-1.2-only",
"gfdl1.2+": "GFDL-1.2-or-later",
"gfdl1.2+invariants": "GFDL-1.2-invariants-or-later",
"gfdl1.2+noinvariants": "GFDL-1.2-no-invariants-or-later",
"gfdl1.2.0": "GFDL-1.2-only",
"gfdl1.2.0+": "GFDL-1.2-or-later",
"gfdl1.2.0+invariants": "GFDL-1.2-invariants-or-later",
"gfdl1.2.0+noinvariants": "GFDL-1.2-no-invariants-or-later",
"gfdl1.2.0invariantsonly": "GFDL-1.2-invariants-only",
"gfdl1.2.0invariantsorlater": "GFDL-1.2-invariants-or-later",
"gfdl1.2.0noinvariantsonly": "GFDL-1.2-no-invariants-only",
Expand All @@ -577,7 +598,13 @@ func Test_processSPDXLicense(t *testing.T) {
"gfdl1.2only": "GFDL-1.2-only",
"gfdl1.2orlater": "GFDL-1.2-or-later",
"gfdl1.3": "GFDL-1.3-only",
"gfdl1.3+": "GFDL-1.3-or-later",
"gfdl1.3+invariants": "GFDL-1.3-invariants-or-later",
"gfdl1.3+noinvariants": "GFDL-1.3-no-invariants-or-later",
"gfdl1.3.0": "GFDL-1.3-only",
"gfdl1.3.0+": "GFDL-1.3-or-later",
"gfdl1.3.0+invariants": "GFDL-1.3-invariants-or-later",
"gfdl1.3.0+noinvariants": "GFDL-1.3-no-invariants-or-later",
"gfdl1.3.0invariantsonly": "GFDL-1.3-invariants-only",
"gfdl1.3.0invariantsorlater": "GFDL-1.3-invariants-or-later",
"gfdl1.3.0noinvariantsonly": "GFDL-1.3-no-invariants-only",
Expand Down
6 changes: 2 additions & 4 deletions internal/spdxlicense/generate/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ func buildLicenseIDPermutations(cleanID string) (perms []string) {
lv := findLicenseVersion(cleanID)
addPlusPermutation := strings.HasSuffix(cleanID, "orlater")
vp := versionPermutations(lv)

permSet := strset.New()
version := strings.Join(lv, ".")
for _, p := range vp {
if addPlusPermutation {
base := strings.TrimSuffix(cleanID, "orlater")
p += "+"
permSet.Add(strings.Replace(base, version, p, 1))
continue
plus := p + "+"
permSet.Add(strings.Replace(base, version, plus, 1))
}
permSet.Add(strings.Replace(cleanID, version, p, 1))
}
Expand Down
3 changes: 3 additions & 0 deletions internal/spdxlicense/generate/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func TestLicensePermutations(t *testing.T) {
"gpl3orlater",
"gpl3.0orlater",
"gpl3.0.0orlater",
"gpl3.0.0+",
"gpl3.0+",
"gpl3+",
},
},
{
Expand Down
Loading

0 comments on commit ef05a45

Please sign in to comment.