forked from mirror/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1010 B
51 lines
1010 B
10 years ago
|
package rpc
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
10 years ago
|
func TestInvalidTypeError(t *testing.T) {
|
||
|
err := NewInvalidTypeError("testField", "not string")
|
||
|
expected := "invalid type on field testField: not string"
|
||
|
|
||
|
if err.Error() != expected {
|
||
|
t.Error(err.Error())
|
||
|
}
|
||
|
}
|
||
|
|
||
10 years ago
|
func TestInsufficientParamsError(t *testing.T) {
|
||
|
err := NewInsufficientParamsError(0, 1)
|
||
|
expected := "insufficient params, want 1 have 0"
|
||
|
|
||
|
if err.Error() != expected {
|
||
|
t.Error(err.Error())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestNotImplementedError(t *testing.T) {
|
||
|
err := NewNotImplementedError("foo")
|
||
|
expected := "foo method not implemented"
|
||
|
|
||
|
if err.Error() != expected {
|
||
|
t.Error(err.Error())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestDecodeParamError(t *testing.T) {
|
||
|
err := NewDecodeParamError("foo")
|
||
|
expected := "could not decode, foo"
|
||
|
|
||
|
if err.Error() != expected {
|
||
|
t.Error(err.Error())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestValidationError(t *testing.T) {
|
||
|
err := NewValidationError("foo", "should be `bar`")
|
||
|
expected := "foo not valid, should be `bar`"
|
||
|
|
||
|
if err.Error() != expected {
|
||
|
t.Error(err.Error())
|
||
|
}
|
||
|
}
|