From e64eb18ccf5a2a9a908b588e446a6c4a76507e7a Mon Sep 17 00:00:00 2001 From: esell Date: Mon, 15 Oct 2018 10:45:29 -0600 Subject: [PATCH] add unit tests for runtime/core - source (#126) --- pkg/runtime/core/source_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/runtime/core/source_test.go diff --git a/pkg/runtime/core/source_test.go b/pkg/runtime/core/source_test.go new file mode 100644 index 00000000..b201b1fc --- /dev/null +++ b/pkg/runtime/core/source_test.go @@ -0,0 +1,24 @@ +package core_test + +import ( + "fmt" + "testing" + + "github.com/MontFerret/ferret/pkg/runtime/core" + . "github.com/smartystreets/goconvey/convey" +) + +func TestNewSourceMap(t *testing.T) { + Convey("Should match", t, func() { + s := core.NewSourceMap("test", 1, 100) + sFmt := fmt.Sprintf("%s at %d:%d", "test", 1, 100) + + So(s, ShouldNotBeNil) + + So(s.Line(), ShouldEqual, 1) + + So(s.Column(), ShouldEqual, 100) + + So(s.String(), ShouldEqual, sFmt) + }) +}