From 68a4286549bfce6e97b54b2dee4a99e77b28ed21 Mon Sep 17 00:00:00 2001 From: Aditya Sirish Date: Wed, 1 Dec 2021 14:05:55 -0500 Subject: [PATCH] Add json.RawMessage test for TUF target Signed-off-by: Aditya Sirish --- cjson/canonicaljson_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cjson/canonicaljson_test.go b/cjson/canonicaljson_test.go index 80812dd..d1f643d 100644 --- a/cjson/canonicaljson_test.go +++ b/cjson/canonicaljson_test.go @@ -2,6 +2,7 @@ package cjson import ( "bytes" + "encoding/json" "strings" "testing" ) @@ -52,13 +53,14 @@ func TestEncodeCanonical(t *testing.T) { KeyType: "type", Scheme: "scheme", }, + json.RawMessage(`{"_type":"targets","spec_version":"1.0","version":0,"expires":"0001-01-01T00:00:00Z","targets":{},"custom":{"test":true}}`), } expectedResult := []string{ `{"keyid":"","keyid_hash_algorithms":null,"keytype":"","keyval":{"private":"","public":""},"scheme":""}`, `{"keyid":"id","keyid_hash_algorithms":["hash"],"keytype":"type","keyval":{"private":"priv","public":"pub"},"scheme":"scheme"}`, `{"false":false,"int":3,"int2":42,"nil":null,"string":"\\\"","true":true}`, `{"keyid":"id","keyid_hash_algorithms":["hash"],"keytype":"type","keyval":{"certificate":"cert","private":"priv","public":"pub"},"scheme":"scheme"}`, - "", + `{"_type":"targets","custom":{"test":true},"expires":"0001-01-01T00:00:00Z","spec_version":"1.0","targets":{},"version":0}`, } for i := 0; i < len(objects); i++ { result, err := EncodeCanonical(objects[i])