aboutsummaryrefslogtreecommitdiff
path: root/spdxconv_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-14 04:40:19 +0700
committerShulhan <ms@kilabit.info>2026-01-14 04:40:19 +0700
commitb37a4cd18827d6a8dafe2729ba72a8e13e8fbb8c (patch)
treefec0411825230780e08a8cf6619b683e46898e01 /spdxconv_test.go
parent9801b1cf64dbf8340fe532542bae186a6bb507dd (diff)
downloadspdxconv-b37a4cd18827d6a8dafe2729ba72a8e13e8fbb8c.tar.xz
all: fix error when scanning and apply empty file
Diffstat (limited to 'spdxconv_test.go')
-rw-r--r--spdxconv_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/spdxconv_test.go b/spdxconv_test.go
index aa37cba..f473a2e 100644
--- a/spdxconv_test.go
+++ b/spdxconv_test.go
@@ -189,6 +189,38 @@ func TestApply(t *testing.T) {
}
}
+func TestApply_fromReport(t *testing.T) {
+ // Populate the test files.
+
+ var testData *test.Data
+ var err error
+ testData, err = test.LoadData(`testdata/Apply_fromReport_test.txt`)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var tempDir = `testdata/Apply_fromReport/`
+ testData.ExtractInput(tempDir)
+ t.Chdir(tempDir)
+
+ err = Apply()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for input, _ := range testData.Input {
+ if input == ConfigFile || input == ReportFile {
+ continue
+ }
+
+ got, err := os.ReadFile(input)
+ if err != nil {
+ t.Fatal(err)
+ }
+ test.Assert(t, input+`: after`,
+ string(testData.Output[input]), string(got))
+ }
+}
+
func TestNew(t *testing.T) {
type testCase struct {
exp *SPDXConv