Skip to content

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Sep 20, 2021
1 parent 192dba5 commit 4f6a3d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/compiler/compiler_for_ternary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ func TestForTernaryExpression(t *testing.T) {
So(string(out2), ShouldEqual, `[1,2,3,4,5]`)
})

Convey("RETURN foo ? (FOR i IN 1..5 RETURN T::PANIC())? : (FOR i IN 1..5 RETURN T::PANIC())?", t, func() {
Convey("RETURN foo ? (FOR i IN 1..5 RETURN T::FAIL())? : (FOR i IN 1..5 RETURN T::FAIL())?", t, func() {
c := compiler.New()

out1, err := c.MustCompile(`
LET foo = FALSE
RETURN foo ? (FOR i IN 1..5 RETURN T::PANIC()) : (FOR i IN 1..5 RETURN T::PANIC())?
RETURN foo ? (FOR i IN 1..5 RETURN T::FAIL()) : (FOR i IN 1..5 RETURN T::FAIL())?
`).Run(context.Background())

So(err, ShouldBeNil)
So(string(out1), ShouldEqual, `null`)

out2, err := c.MustCompile(`
LET foo = FALSE
RETURN foo ? (FOR i IN 1..5 RETURN T::PANIC())? : (FOR i IN 1..5 RETURN T::PANIC())
LET foo = TRUE
RETURN foo ? (FOR i IN 1..5 RETURN T::FAIL())? : (FOR i IN 1..5 RETURN T::FAIL())
`).Run(context.Background())

So(err, ShouldBeNil)
Expand Down Expand Up @@ -124,11 +124,11 @@ func TestForTernaryExpression(t *testing.T) {
So(string(out2), ShouldEqual, `[1,2,3,4,5]`)
})

Convey("LET res = (FOR i IN 1..5 RETURN T::PANIC())? ? TRUE : FALSE", t, func() {
Convey("LET res = (FOR i IN 1..5 RETURN T::FAIL())? ? TRUE : FALSE", t, func() {
c := compiler.New()

out1, err := c.MustCompile(`
LET res = (FOR i IN 1..5 RETURN T::PANIC())? ? TRUE : FALSE
LET res = (FOR i IN 1..5 RETURN T::FAIL())? ? TRUE : FALSE
RETURN res
`).Run(context.Background())

Expand Down

0 comments on commit 4f6a3d1

Please sign in to comment.