aboutsummaryrefslogtreecommitdiff
path: root/report_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'report_test.go')
-rw-r--r--report_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/report_test.go b/report_test.go
new file mode 100644
index 0000000..74d1f7a
--- /dev/null
+++ b/report_test.go
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-3.0-only
+// SPDX-FileCopyrightText: 2026 M. Shulhan <ms@kilabit.info>
+
+package spdxconv
+
+import (
+ "testing"
+
+ "git.sr.ht/~shulhan/pakakeh.go/lib/test"
+)
+
+func TestLoadReport(t *testing.T) {
+ workDir := `testdata/loadReport/ok/`
+ t.Chdir(workDir)
+
+ got, err := loadReport()
+ if err != nil {
+ t.Fatal(err)
+ }
+ exp := &report{
+ listRegular: []*file{{
+ path: `fileR1`,
+ licenseID: valDefault,
+ copyrightYear: valUnknown,
+ copyrightText: valDefault,
+ }, {
+ path: `file R2`,
+ licenseID: valExist,
+ idxLicenseID: 1,
+ copyrightYear: `2024`,
+ copyrightText: valExist,
+ idxCopyrightText: -1,
+ }},
+ listBinary: []*file{{
+ path: `fileB1`,
+ licenseID: `BSD-3-Clause`,
+ copyrightYear: `2000-2026`,
+ copyrightText: `Author <contact@email.local>`,
+ }},
+ listUnknown: []*file{{
+ path: `fileU1`,
+ licenseID: valExist,
+ idxLicenseID: -1,
+ copyrightYear: `2000`,
+ copyrightText: valExist,
+ idxCopyrightText: 2,
+ }},
+ }
+ test.Assert(t, workDir, exp, got)
+}