Skip to content

Commit

Permalink
Merge pull request #119 from swinslow/issue116
Browse files Browse the repository at this point in the history
builder: Add missing LicenseInfoInFile field
  • Loading branch information
swinslow committed Mar 26, 2022
2 parents bea3d05 + 61e7c1b commit 6ce7cd0
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 30 deletions.
80 changes: 60 additions & 20 deletions builder/build_test.go
Expand Up @@ -141,8 +141,12 @@ func TestBuild2_1CreatesDocument(t *testing.T) {
if fileEmpty.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseConcluded)
}
if len(fileEmpty.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(fileEmpty.LicenseInfoInFile))
if len(fileEmpty.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(fileEmpty.LicenseInfoInFile))
} else {
if fileEmpty.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseInfoInFile[0])
}
}
if fileEmpty.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.FileCopyrightText)
Expand Down Expand Up @@ -171,8 +175,12 @@ func TestBuild2_1CreatesDocument(t *testing.T) {
if file1.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseConcluded)
}
if len(file1.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file1.LicenseInfoInFile))
if len(file1.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file1.LicenseInfoInFile))
} else {
if file1.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseInfoInFile[0])
}
}
if file1.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.FileCopyrightText)
Expand Down Expand Up @@ -201,8 +209,12 @@ func TestBuild2_1CreatesDocument(t *testing.T) {
if file3.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.LicenseConcluded)
}
if len(file3.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file3.LicenseInfoInFile))
if len(file3.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file3.LicenseInfoInFile))
} else {
if file3.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.LicenseInfoInFile[0])
}
}
if file3.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.FileCopyrightText)
Expand Down Expand Up @@ -231,8 +243,12 @@ func TestBuild2_1CreatesDocument(t *testing.T) {
if file4.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.LicenseConcluded)
}
if len(file4.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file4.LicenseInfoInFile))
if len(file4.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file4.LicenseInfoInFile))
} else {
if file4.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.LicenseInfoInFile[0])
}
}
if file4.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.FileCopyrightText)
Expand Down Expand Up @@ -261,8 +277,12 @@ func TestBuild2_1CreatesDocument(t *testing.T) {
if lastfile.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.LicenseConcluded)
}
if len(lastfile.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(lastfile.LicenseInfoInFile))
if len(lastfile.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(lastfile.LicenseInfoInFile))
} else {
if lastfile.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.LicenseInfoInFile[0])
}
}
if lastfile.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.FileCopyrightText)
Expand Down Expand Up @@ -501,8 +521,12 @@ func TestBuild2_2CreatesDocument(t *testing.T) {
if fileEmpty.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseConcluded)
}
if len(fileEmpty.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(fileEmpty.LicenseInfoInFile))
if len(fileEmpty.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(fileEmpty.LicenseInfoInFile))
} else {
if fileEmpty.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseInfoInFile[0])
}
}
if fileEmpty.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.FileCopyrightText)
Expand Down Expand Up @@ -538,8 +562,12 @@ func TestBuild2_2CreatesDocument(t *testing.T) {
if file1.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseConcluded)
}
if len(file1.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file1.LicenseInfoInFile))
if len(file1.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file1.LicenseInfoInFile))
} else {
if file1.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseInfoInFile[0])
}
}
if file1.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.FileCopyrightText)
Expand Down Expand Up @@ -575,8 +603,12 @@ func TestBuild2_2CreatesDocument(t *testing.T) {
if file3.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.LicenseConcluded)
}
if len(file3.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file3.LicenseInfoInFile))
if len(file3.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file3.LicenseInfoInFile))
} else {
if file3.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.LicenseInfoInFile[0])
}
}
if file3.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file3.FileCopyrightText)
Expand Down Expand Up @@ -612,8 +644,12 @@ func TestBuild2_2CreatesDocument(t *testing.T) {
if file4.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.LicenseConcluded)
}
if len(file4.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file4.LicenseInfoInFile))
if len(file4.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file4.LicenseInfoInFile))
} else {
if file4.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.LicenseInfoInFile[0])
}
}
if file4.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file4.FileCopyrightText)
Expand Down Expand Up @@ -649,8 +685,12 @@ func TestBuild2_2CreatesDocument(t *testing.T) {
if lastfile.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.LicenseConcluded)
}
if len(lastfile.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(lastfile.LicenseInfoInFile))
if len(lastfile.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(lastfile.LicenseInfoInFile))
} else {
if lastfile.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.LicenseInfoInFile[0])
}
}
if lastfile.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", lastfile.FileCopyrightText)
Expand Down
2 changes: 1 addition & 1 deletion builder/builder2v1/build_file.go
Expand Up @@ -36,7 +36,7 @@ func BuildFileSection2_1(filePath string, prefix string, fileNumber int) (*spdx.
FileChecksumSHA256: ssha256,
FileChecksumMD5: smd5,
LicenseConcluded: "NOASSERTION",
LicenseInfoInFile: []string{},
LicenseInfoInFile: []string{"NOASSERTION"},
FileCopyrightText: "NOASSERTION",
}

Expand Down
8 changes: 6 additions & 2 deletions builder/builder2v1/build_file_test.go
Expand Up @@ -40,8 +40,12 @@ func TestBuilder2_1CanBuildFileSection(t *testing.T) {
if file1.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseConcluded)
}
if len(file1.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file1.LicenseInfoInFile))
if len(file1.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file1.LicenseInfoInFile))
} else {
if file1.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseInfoInFile[0])
}
}
if file1.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.FileCopyrightText)
Expand Down
8 changes: 6 additions & 2 deletions builder/builder2v1/build_package_test.go
Expand Up @@ -83,8 +83,12 @@ func TestBuilder2_1CanBuildPackageSection(t *testing.T) {
if fileEmpty.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseConcluded)
}
if len(fileEmpty.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(fileEmpty.LicenseInfoInFile))
if len(fileEmpty.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(fileEmpty.LicenseInfoInFile))
} else {
if fileEmpty.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseInfoInFile[0])
}
}
if fileEmpty.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.FileCopyrightText)
Expand Down
2 changes: 1 addition & 1 deletion builder/builder2v2/build_file.go
Expand Up @@ -47,7 +47,7 @@ func BuildFileSection2_2(filePath string, prefix string, fileNumber int) (*spdx.
},
},
LicenseConcluded: "NOASSERTION",
LicenseInfoInFile: []string{},
LicenseInfoInFile: []string{"NOASSERTION"},
FileCopyrightText: "NOASSERTION",
}

Expand Down
8 changes: 6 additions & 2 deletions builder/builder2v2/build_file_test.go
Expand Up @@ -47,8 +47,12 @@ func TestBuilder2_2CanBuildFileSection(t *testing.T) {
if file1.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseConcluded)
}
if len(file1.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(file1.LicenseInfoInFile))
if len(file1.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(file1.LicenseInfoInFile))
} else {
if file1.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.LicenseInfoInFile[0])
}
}
if file1.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", file1.FileCopyrightText)
Expand Down
8 changes: 6 additions & 2 deletions builder/builder2v2/build_package_test.go
Expand Up @@ -90,8 +90,12 @@ func TestBuilder2_2CanBuildPackageSection(t *testing.T) {
if fileEmpty.LicenseConcluded != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseConcluded)
}
if len(fileEmpty.LicenseInfoInFile) != 0 {
t.Errorf("expected %v, got %v", 0, len(fileEmpty.LicenseInfoInFile))
if len(fileEmpty.LicenseInfoInFile) != 1 {
t.Errorf("expected %v, got %v", 1, len(fileEmpty.LicenseInfoInFile))
} else {
if fileEmpty.LicenseInfoInFile[0] != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.LicenseInfoInFile[0])
}
}
if fileEmpty.FileCopyrightText != "NOASSERTION" {
t.Errorf("expected %v, got %v", "NOASSERTION", fileEmpty.FileCopyrightText)
Expand Down

0 comments on commit 6ce7cd0

Please sign in to comment.