1 // Copyright (c) 2017 The btcsuite developers
2 // Copyright (c) 2017 The Decred developers
3 // Use of this source code is governed by an ISC
4 // license that can be found in the LICENSE file.
12 "github.com/btcsuite/btcd/btcjson"
15 // TestChainSvrWsResults ensures any results that have custom marshalling
17 func TestChainSvrWsResults(t *testing.T) {
26 name: "RescannedBlock",
27 result: &btcjson.RescannedBlock{
29 Transactions: []string{"serializedtx"},
31 expected: `{"hash":"blockhash","transactions":["serializedtx"]}`,
35 t.Logf("Running %d tests", len(tests))
36 for i, test := range tests {
37 marshalled, err := json.Marshal(test.result)
39 t.Errorf("Test #%d (%s) unexpected error: %v", i,
43 if string(marshalled) != test.expected {
44 t.Errorf("Test #%d (%s) unexpected marhsalled data - "+
45 "got %s, want %s", i, test.name, marshalled,