From 54a8c0f81baa6e7a6bad11ba8be3ccadbe3267b3 Mon Sep 17 00:00:00 2001 From: esell Date: Fri, 5 Oct 2018 09:51:43 -0600 Subject: [PATCH] more unit test for runtime/core - errors --- pkg/runtime/core/errors_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/runtime/core/errors_test.go b/pkg/runtime/core/errors_test.go index 328fe9f4..ff3eafff 100644 --- a/pkg/runtime/core/errors_test.go +++ b/pkg/runtime/core/errors_test.go @@ -22,6 +22,23 @@ func TestSourceError(t *testing.T) { }) } +func TestTypeError(t *testing.T) { + Convey("Should match", t, func() { + e := core.TypeError(1) + So(e, ShouldNotBeNil) + + e = core.TypeError(1, 1) + So(e, ShouldNotBeNil) + + e = core.TypeError(1, 1, 2, 3) + So(e, ShouldNotBeNil) + + cause := errors.New("invalid type: expected none or boolean or int or float, but got none") + e = core.TypeError(0, 0, 1, 2, 3) + So(e.Error(), ShouldEqual, cause.Error()) + }) +} + func TestError(t *testing.T) { Convey("Should match", t, func() { msg := "test message"