From 55b9689950dbb3f47e2d4720d04d2539243429bd Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 1 Apr 2015 15:53:48 +0200 Subject: rename messages to types --- rpc/types_test.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 rpc/types_test.go (limited to 'rpc/types_test.go') 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()) + } +} -- cgit v1.2.3