1 // Copyright (c) 2016-2017 The btcsuite developers
2 // Copyright (c) 2015-2016 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 // TestBtcdExtCustomResults ensures any results that have custom marshalling
17 // and unmarshal code of results are as expected.
18 func TestBtcdExtCustomResults(t *testing.T) {
27 name: "versionresult",
28 result: &btcjson.VersionResult{
29 VersionString: "1.0.0",
36 expected: `{"versionstring":"1.0.0","major":1,"minor":0,"patch":0,"prerelease":"pr","buildmetadata":"bm"}`,
40 t.Logf("Running %d tests", len(tests))
41 for i, test := range tests {
42 marshalled, err := json.Marshal(test.result)
44 t.Errorf("Test #%d (%s) unexpected error: %v", i,
48 if string(marshalled) != test.expected {
49 t.Errorf("Test #%d (%s) unexpected marhsalled data - "+
50 "got %s, want %s", i, test.name, marshalled,