aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/types_test.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 21:53:48 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 21:53:48 +0800
commit55b9689950dbb3f47e2d4720d04d2539243429bd (patch)
tree1ed9a2cda6b8c5a4ceaeb13abd70bd1e49fe0e3a /rpc/types_test.go
parentbea3879d6f5862886948b9045b6c6111b41f8480 (diff)
downloadgo-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar.gz
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar.bz2
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar.lz
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar.xz
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.tar.zst
go-tangerine-55b9689950dbb3f47e2d4720d04d2539243429bd.zip
rename messages to types
Diffstat (limited to 'rpc/types_test.go')
-rw-r--r--rpc/types_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/rpc/types_test.go b/rpc/types_test.go
new file mode 100644
index 000000000..91f0152dc
--- /dev/null
+++ b/rpc/types_test.go
@@ -0,0 +1,50 @@
+package rpc
+
+import (
+ "testing"
+)
+
+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())
+ }
+}
+
+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())
+ }
+}