Skip to content

Commit a25809c

Browse files
committed
Add test to assure we can unmarshal empty definitions and declarations objects for v1.6
Signed-off-by: Matt Rutkowski <[email protected]>
1 parent f3afb63 commit a25809c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"databind",
3030
"Debugf",
3131
"defn",
32+
"Defns",
3233
"deserializers",
3334
"DHTML",
3435
"dropwizard",

cmd/component_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ const (
4040
TEST_COMPONENT_LIST_CDX_1_6_CBOM = TEST_CDX_1_6_CRYPTO_BOM
4141
// test/cyclonedx/1.6/cdx-1-6-valid-mlbom-environmental-considerations.json
4242
TEST_COMPONENT_LIST_CDX_1_6_MLBOM = TEST_CDX_1_6_MACHINE_LEARNING_BOM
43+
// test/cyclonedx/1.6/specification/valid-empty-defns-decls.json
44+
// Test general BOM with empty top-level bom objects, but valid components
45+
TEST_COMPONENT_LIST_CDX_1_6_SBOM = "test/cyclonedx/1.6/specification/valid-empty-defns-decls.json"
4346
)
4447

4548
var COMPONENT_TEST_DEFAULT_FLAGS utils.ComponentCommandFlags
@@ -225,3 +228,8 @@ func TestComponentListCdx16ValidComponentTypes(t *testing.T) {
225228
ti := NewComponentTestInfoBasic(TEST_CDX_SPEC_1_6_VALID_COMPONENT_TYPES, FORMAT_CSV, nil)
226229
innerTestComponentList(t, ti, COMPONENT_TEST_DEFAULT_FLAGS)
227230
}
231+
232+
func TestComponentListCdx16EmptyDefnsDecls(t *testing.T) {
233+
ti := NewComponentTestInfoBasic(TEST_COMPONENT_LIST_CDX_1_6_SBOM, FORMAT_CSV, nil)
234+
innerTestComponentList(t, ti, COMPONENT_TEST_DEFAULT_FLAGS)
235+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
4+
"components": [
5+
{
6+
"type": "library",
7+
"name": "somelib"
8+
}
9+
],
10+
"definitions": {
11+
"standards": []
12+
},
13+
"declaration": {
14+
"attestations": []
15+
}
16+
}

0 commit comments

Comments
 (0)