github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/formats/cyclonedxjson/format_test.go (about) 1 package cyclonedxjson 2 3 import ( 4 "testing" 5 6 "github.com/CycloneDX/cyclonedx-go" 7 ) 8 9 func TestFormatVersions(t *testing.T) { 10 tests := []struct { 11 name string 12 expectedVersion string 13 }{ 14 { 15 16 "cyclonedx-json should default to v1.4", 17 cyclonedx.SpecVersion1_4.String(), 18 }, 19 } 20 21 for _, c := range tests { 22 c := c 23 t.Run(c.name, func(t *testing.T) { 24 sbomFormat := Format() 25 if sbomFormat.ID() != ID { 26 t.Errorf("expected ID %q, got %q", ID, sbomFormat.ID()) 27 } 28 29 if sbomFormat.Version() != c.expectedVersion { 30 t.Errorf("expected version %q, got %q", c.expectedVersion, sbomFormat.Version()) 31 } 32 }) 33 } 34 }