pipes, binary, unary and post operators test
This commit is contained in:
parent
c05263b24c
commit
6b2e509aea
|
@ -167,6 +167,9 @@ describe("Peggy parse", () => {
|
|||
describe("pipe", () => {
|
||||
testParse("1 -> add(2)", "{(::add 1 2)}")
|
||||
testParse("-1 -> add(2)", "{(::add (::unaryMinus 1) 2)}")
|
||||
testParse("-a[1] -> add(2)", "{(::add (::unaryMinus (::$atIndex :a 1)) 2)}")
|
||||
testParse("-f(1) -> add(2)", "{(::add (::unaryMinus (::f 1)) 2)}")
|
||||
testParse("1 + 2 -> add(3)", "{(::add 1 (::add 2 3))}")
|
||||
testParse("1 -> add(2) * 3", "{(::multiply (::add 1 2) 3)}")
|
||||
testParse("1 -> subtract(2)", "{(::subtract 1 2)}")
|
||||
testParse("-1 -> subtract(2)", "{(::subtract (::unaryMinus 1) 2)}")
|
||||
|
@ -174,6 +177,7 @@ describe("Peggy parse", () => {
|
|||
})
|
||||
|
||||
describe("elixir pipe", () => {
|
||||
//handled together with -> so there is no need for seperate tests
|
||||
testParse("1 |> add(2)", "{(::add 1 2)}")
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user