Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder: Add missing LicenseInfoInFile field #119

Merged
merged 1 commit into from Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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