aboutsummaryrefslogtreecommitdiff
path: root/report_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-10 18:20:52 +0700
committerShulhan <ms@kilabit.info>2026-01-10 18:20:52 +0700
commit187cf1cb9cc684f3860426be86e9c682aa6c849f (patch)
tree95bb19caf30f9685916c453dcff4e4c0297a3fbf /report_test.go
parent6b1ee0dbb0e0801afbf98199e0ca0dd5b2dbe3cb (diff)
downloadspdxconv-187cf1cb9cc684f3860426be86e9c682aa6c849f.tar.xz
report: store the index line number and comments in report
For the index line number, instead of tied to license_id and copyright_id value (separated by ":"), store it in separate column as idx_license_id and idx_copyright_id. For comments, store the prefix and suffix at column 6 and 7 in CSV line.
Diffstat (limited to 'report_test.go')
-rw-r--r--report_test.go29
1 files changed, 20 insertions, 9 deletions
diff --git a/report_test.go b/report_test.go
index 74d1f7a..db43739 100644
--- a/report_test.go
+++ b/report_test.go
@@ -23,6 +23,7 @@ func TestLoadReport(t *testing.T) {
licenseID: valDefault,
copyrightYear: valUnknown,
copyrightText: valDefault,
+ commentPrefix: `# `,
}, {
path: `file R2`,
licenseID: valExist,
@@ -30,20 +31,30 @@ func TestLoadReport(t *testing.T) {
copyrightYear: `2024`,
copyrightText: valExist,
idxCopyrightText: -1,
+ commentPrefix: `// `,
+ }, {
+ path: `fileR3`,
+ licenseID: valMatch,
+ idxLicenseID: -2,
+ copyrightYear: `2000-2026`,
+ copyrightText: valMatch,
+ idxCopyrightText: -3,
+ commentPrefix: `<!-- `,
+ commentSuffix: ` -->`,
}},
listBinary: []*file{{
path: `fileB1`,
- licenseID: `BSD-3-Clause`,
- copyrightYear: `2000-2026`,
- copyrightText: `Author <contact@email.local>`,
+ licenseID: valDefault,
+ copyrightYear: valUnknown,
+ copyrightText: valDefault,
+ isBinary: true,
}},
listUnknown: []*file{{
- path: `fileU1`,
- licenseID: valExist,
- idxLicenseID: -1,
- copyrightYear: `2000`,
- copyrightText: valExist,
- idxCopyrightText: 2,
+ path: `fileU1`,
+ licenseID: valDefault,
+ copyrightYear: valUnknown,
+ copyrightText: valDefault,
+ isUnknown: true,
}},
}
test.Assert(t, workDir, exp, got)