Skip to content

Commit 68a4286

Browse files
committed
Add json.RawMessage test for TUF target
Signed-off-by: Aditya Sirish <[email protected]>
1 parent 08a5288 commit 68a4286

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cjson/canonicaljson_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cjson
22

33
import (
44
"bytes"
5+
"encoding/json"
56
"strings"
67
"testing"
78
)
@@ -52,13 +53,14 @@ func TestEncodeCanonical(t *testing.T) {
5253
KeyType: "type",
5354
Scheme: "scheme",
5455
},
56+
json.RawMessage(`{"_type":"targets","spec_version":"1.0","version":0,"expires":"0001-01-01T00:00:00Z","targets":{},"custom":{"test":true}}`),
5557
}
5658
expectedResult := []string{
5759
`{"keyid":"","keyid_hash_algorithms":null,"keytype":"","keyval":{"private":"","public":""},"scheme":""}`,
5860
`{"keyid":"id","keyid_hash_algorithms":["hash"],"keytype":"type","keyval":{"private":"priv","public":"pub"},"scheme":"scheme"}`,
5961
`{"false":false,"int":3,"int2":42,"nil":null,"string":"\\\"","true":true}`,
6062
`{"keyid":"id","keyid_hash_algorithms":["hash"],"keytype":"type","keyval":{"certificate":"cert","private":"priv","public":"pub"},"scheme":"scheme"}`,
61-
"",
63+
`{"_type":"targets","custom":{"test":true},"expires":"0001-01-01T00:00:00Z","spec_version":"1.0","targets":{},"version":0}`,
6264
}
6365
for i := 0; i < len(objects); i++ {
6466
result, err := EncodeCanonical(objects[i])

0 commit comments

Comments
 (0)