func TestMiscErrors(t *testing.T) {
	t.Parallel()

	// Force an error in NewRequest by giving it a parameter type that is
	// not supported.
	_, err := btcjson.NewRequest(nil, "test", []interface{}{make(chan int)})
	if err == nil {
		t.Error("NewRequest: did not receive error")
		return
	}

	// Force an error in MarshalResponse by giving it an id type that is not
	// supported.
	wantErr := btcjson.Error{ErrorCode: btcjson.ErrInvalidType}
	_, err = btcjson.MarshalResponse(make(chan int), nil, nil)
	if jerr, ok := err.(btcjson.Error); !ok || jerr.ErrorCode != wantErr.ErrorCode {
		t.Errorf("MarshalResult: did not receive expected error - got "+
			"%v (%[1]T), want %v (%[2]T)", err, wantErr)
		return
	}

	// Force an error in MarshalResponse by giving it a result type that
	// can't be marshalled.
	_, err = btcjson.MarshalResponse(1, make(chan int), nil)
	if _, ok := err.(*json.UnsupportedTypeError); !ok {
		wantErr := &json.UnsupportedTypeError{}
		t.Errorf("MarshalResult: did not receive expected error - got "+
			"%v (%[1]T), want %T", err, wantErr)
		return
	}
}
// TestMiscErrors tests a few error conditions not covered elsewhere.
TestMiscErrors tests a few error conditions not covered elsewhere.
// TestMiscErrors tests a few error conditions not covered elsewhere .
func TestMiscErrors(t *testing.T) {
	t.Parallel()
	_, err := btcjson.NewRequest(nil, "test", []interface{}{make(chan int)})
	if err == nil {
		t.Error("NewRequest: did not receive error")
		return
	}
	wantErr := btcjson.Error{ErrorCode: btcjson.ErrInvalidType}
	_, err = btcjson.MarshalResponse(make(chan int), nil, nil)
	if jerr, ok := err.(btcjson.Error); !ok || jerr.ErrorCode != wantErr.ErrorCode {
		t.Errorf("MarshalResult: did not receive expected error - got "+
			"%v (%[1]T), want %v (%[2]T)", err, wantErr)
		return
	}
	_, err = btcjson.MarshalResponse(1, make(chan int), nil)
	if _, ok := err.(*json.UnsupportedTypeError); !ok {
		wantErr := &json.UnsupportedTypeError{}
		t.Errorf("MarshalResult: did not receive expected error - got "+
			"%v (%[1]T), want %T", err, wantErr)
		return
	}
}
func TestMiscErrors ( t * testing . T ) { t . Parallel ( ) _ , err := btcjson . NewRequest ( nil , " " , [ ] interface { } { make ( chan int ) } ) if err == nil { t . Error ( " " ) return } wantErr := btcjson . Error { ErrorCode : btcjson . ErrInvalidType } _ , err = btcjson . MarshalResponse ( make ( chan int ) , nil , nil ) if jerr , ok := err . ( btcjson . Error ) ; ! ok || jerr . ErrorCode != wantErr . ErrorCode { t . Errorf ( " " + " " , err , wantErr ) return } _ , err = btcjson . MarshalResponse ( 1 , make ( chan int ) , nil ) if _ , ok := err . ( * json . UnsupportedTypeError ) ; ! ok { wantErr := & json . UnsupportedTypeError { } t . Errorf ( " " + " " , err , wantErr ) return } }
TestMiscErrors tests a few error conditions not covered elsewhere.
TestMiscErrors tests a few error conditions not covered elsewhere .
// Force an error in NewRequest by giving it a parameter type that is // not supported. // Force an error in MarshalResponse by giving it an id type that is not // supported. // Force an error in MarshalResponse by giving it a result type that // can't be marshalled.