1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package json
import (
"os"
"testing"
)
// TestRead tests that the SPDX Reader can still parse json documents correctly
// this protects against any of the custom unmarshalling code breaking given a new change set
func TestRead(t *testing.T) {
tt := []struct {
filename string
}{
{"test_fixtures/spdx2_3.json"},
}
for _, tc := range tt {
t.Run(tc.filename, func(t *testing.T) {
file, err := os.Open(tc.filename)
if err != nil {
t.Errorf("error opening %s: %v", tc.filename, err)
}
defer file.Close()
_, err = Read(file)
if err != nil {
t.Errorf("error reading %s: %v", tc.filename, err)
}
})
}
}
|