aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspecter25 <ujjwalcoding012@gmail.com>2021-06-14 02:56:18 +0530
committerspecter25 <ujjwalcoding012@gmail.com>2021-06-14 02:56:18 +0530
commit7616cd5838f61806d41f487d81ee2dddfa0466e9 (patch)
tree930fae6f7830228ac4c583110aa47901948ed660
parent3e91051602f36baf1646e34dfd1738a9b832e312 (diff)
downloadspdx-tools-7616cd5838f61806d41f487d81ee2dddfa0466e9.tar.gz
Bug Fix : Add file and package annotations in the test
Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
-rw-r--r--jsonloader2v2/jsonloader_test.go26
-rw-r--r--jsonloader2v2/parse_creation_info.go2
2 files changed, 21 insertions, 7 deletions
diff --git a/jsonloader2v2/jsonloader_test.go b/jsonloader2v2/jsonloader_test.go
index f70bf55..b0fcf01 100644
--- a/jsonloader2v2/jsonloader_test.go
+++ b/jsonloader2v2/jsonloader_test.go
@@ -84,6 +84,22 @@ func TestLoad2_2(t *testing.T) {
Annotator: "Jane Doe ()",
AnnotationComment: "Document level annotation",
},
+ {
+ AnnotationSPDXIdentifier: spdx.DocElementID{DocumentRefID: "", ElementRefID: "File"},
+ AnnotationDate: "2011-01-29T18:30:22Z",
+ AnnotationType: "OTHER",
+ AnnotatorType: "Person",
+ Annotator: "File Commenter",
+ AnnotationComment: "File level annotation",
+ },
+ {
+ AnnotationSPDXIdentifier: spdx.DocElementID{DocumentRefID: "", ElementRefID: "Package"},
+ AnnotationDate: "2011-01-29T18:30:22Z",
+ AnnotationType: "OTHER",
+ AnnotatorType: "Person",
+ Annotator: "Package Commenter",
+ AnnotationComment: "Package level annotation",
+ },
},
Relationships: []*spdx.Relationship2_2{
{
@@ -330,11 +346,11 @@ func TestLoad2_2(t *testing.T) {
if !reflect.DeepEqual(got.CreationInfo, tt.want.CreationInfo) {
t.Errorf("Load2_2() = %v, want %v", got.CreationInfo, tt.want.CreationInfo)
}
- // for i := 0; i < len(got.Annotations); i++ {
- // if !reflect.DeepEqual(got.Annotations[i], tt.want.Annotations[i]) {
- // t.Errorf("Load2_2() = %v, want %v", got.Annotations[i], tt.want.Annotations[i])
- // }
- // }
+ for i := 0; i < len(tt.want.Annotations); i++ {
+ if !reflect.DeepEqual(got.Annotations[i], tt.want.Annotations[i]) {
+ t.Errorf("Load2_2() = %v, want %v", got.Annotations[i], tt.want.Annotations[i])
+ }
+ }
for i := 0; i < len(got.Relationships); i++ {
if !reflect.DeepEqual(got.Relationships[i], tt.want.Relationships[i]) {
t.Errorf("Load2_2() = %v, want %v", got.Relationships[i], tt.want.Relationships[i])
diff --git a/jsonloader2v2/parse_creation_info.go b/jsonloader2v2/parse_creation_info.go
index 95f5bc0..9ef5ca8 100644
--- a/jsonloader2v2/parse_creation_info.go
+++ b/jsonloader2v2/parse_creation_info.go
@@ -73,7 +73,6 @@ func parseCreators(creators interface{}, ci *spdx.CreationInfo2_2) error {
s := reflect.ValueOf(creators)
for i := 0; i < s.Len(); i++ {
- fmt.Println(s.Index(i))
subkey, subvalue, err := extractSubs(s.Index(i).Interface().(string))
if err != nil {
return err
@@ -99,7 +98,6 @@ func parseExternalDocumentRefs(references interface{}, ci *spdx.CreationInfo2_2)
s := reflect.ValueOf(references)
for i := 0; i < s.Len(); i++ {
- fmt.Println(s.Index(i))
ref := s.Index(i).Interface().(map[string]interface{})
documentRefID := ref["externalDocumentId"].(string)
if !strings.HasPrefix(documentRefID, "DocumentRef-") {