diff --git a/jsonsaver/jsonsaver_test.go b/jsonsaver/jsonsaver_test.go new file mode 100644 index 00000000..2bff9585 --- /dev/null +++ b/jsonsaver/jsonsaver_test.go @@ -0,0 +1,230 @@ +package jsonsaver + +import ( + "bytes" + "testing" + + "github.com/spdx/tools-golang/spdx" +) + +func TestSave2_2(t *testing.T) { + type args struct { + doc *spdx.Document2_2 + } + test1 := &spdx.Document2_2{ + CreationInfo: &spdx.CreationInfo2_2{ + DataLicense: "CC0-1.0", + SPDXVersion: "SPDX-2.2", + SPDXIdentifier: "DOCUMENT", + DocumentComment: "This document was created using SPDX 2.0 using licenses from the web site.", + LicenseListVersion: "3.8", + Created: "2010-01-29T18:30:22Z", + CreatorPersons: []string{"Jane Doe ()"}, + CreatorOrganizations: []string{"ExampleCodeInspect ()"}, + CreatorTools: []string{"LicenseFind-1.0"}, + DocumentName: "SPDX-Tools-v2.0", + DocumentNamespace: "http://spdx.org/spdxdocs/spdx-example-444504E0-4F89-41D3-9A0C-0305E82C3301", + CreatorComment: "This package has been shipped in source and binary form.\nThe binaries were created with gcc 4.5.1 and expect to link to\ncompatible system run time libraries.", + ExternalDocumentReferences: map[string]spdx.ExternalDocumentRef2_2{ + "spdx-tool-1.2": { + DocumentRefID: "spdx-tool-1.2", + URI: "http://spdx.org/spdxdocs/spdx-tools-v1.2-3F2504E0-4F89-41D3-9A0C-0305E82C3301", + Alg: "SHA1", + Checksum: "d6a770ba38583ed4bb4525bd96e50461655d2759", + }, + }, + }, + OtherLicenses: []*spdx.OtherLicense2_2{ + { + ExtractedText: "\"THE BEER-WARE LICENSE\" (Revision 42):\nphk@FreeBSD.ORG wrote this file. As long as you retain this notice you\ncan do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp