1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-07 22:32:35 +02:00

Added var uniqueness check

This commit is contained in:
Tim Voronov
2019-11-14 22:10:55 -05:00
parent 8ee36b78d5
commit d4a92fc64b
2 changed files with 30 additions and 4 deletions

View File

@@ -208,4 +208,27 @@ func TestLet(t *testing.T) {
So(err, ShouldNotBeNil)
})
Convey("Should not compile if a variable not defined", t, func() {
c := compiler.New()
_, err := c.Compile(`
RETURN foo
`)
So(err, ShouldNotBeNil)
})
Convey("Should not compile if a variable is not unique", t, func() {
c := compiler.New()
_, err := c.Compile(`
LET foo = "bar"
LET foo = "baz"
RETURN foo
`)
So(err, ShouldNotBeNil)
})
}