1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-07-13 01:20:35 +02:00

Merge pull request #49 from esell/runtime-tests

more unit test for runtime/core - errors
This commit is contained in:
Tim Voronov
2018-10-05 12:56:21 -04:00
committed by GitHub

View File

@ -22,6 +22,23 @@ func TestSourceError(t *testing.T) {
})
}
func TestTypeError(t *testing.T) {
Convey("Should match", t, func() {
e := core.TypeError(core.BooleanType)
So(e, ShouldNotBeNil)
e = core.TypeError(core.BooleanType, core.BooleanType)
So(e, ShouldNotBeNil)
e = core.TypeError(core.BooleanType, core.BooleanType, core.IntType, core.FloatType)
So(e, ShouldNotBeNil)
cause := errors.New("invalid type: expected none or boolean or int or float, but got none")
e = core.TypeError(core.NoneType, core.NoneType, core.BooleanType, core.IntType, core.FloatType)
So(e.Error(), ShouldEqual, cause.Error())
})
}
func TestError(t *testing.T) {
Convey("Should match", t, func() {
msg := "test message"