2018-10-15 18:50:55 -04:00
|
|
|
package compiler_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"github.com/MontFerret/ferret/pkg/compiler"
|
|
|
|
"github.com/MontFerret/ferret/pkg/runtime"
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestEqualityOperators(t *testing.T) {
|
|
|
|
Convey("Should compile RETURN 2 > 1", t, func() {
|
|
|
|
c := compiler.New()
|
|
|
|
|
2018-10-24 19:40:57 -04:00
|
|
|
p, err := c.Compile(`
|
2018-10-15 18:50:55 -04:00
|
|
|
RETURN 2 > 1
|
|
|
|
`)
|
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
2018-10-24 19:40:57 -04:00
|
|
|
So(p, ShouldHaveSameTypeAs, &runtime.Program{})
|
2018-10-15 18:50:55 -04:00
|
|
|
|
2018-10-24 19:40:57 -04:00
|
|
|
out, err := p.Run(context.Background())
|
2018-10-15 18:50:55 -04:00
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
So(string(out), ShouldEqual, "true")
|
|
|
|
})
|
|
|
|
}
|