update ternary
This commit is contained in:
parent
f547db9d0a
commit
470a6add42
|
@ -78,16 +78,16 @@ describe("Peggy parse", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("ternary operator", () => {
|
describe("ternary operator", () => {
|
||||||
testParse("1 ? 2 : 3", "{(::$$ternary 1 2 3)}")
|
testParse("true ? 2 : 3", "{(::$$ternary true 2 3)}")
|
||||||
testParse("1 ? 2 : 3 ? 4 : 5", "{(::$$ternary 1 2 (::$$ternary 3 4 5))}") // nested ternary
|
testParse("false ? 2 : false ? 4 : 5", "{(::$$ternary false 2 (::$$ternary false 4 5))}") // nested ternary
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("if then else", () => {
|
describe("if then else", () => {
|
||||||
testParse("if 1 then 2 else 3", "{(::$$ternary 1 {2} {3})}")
|
testParse("if true then 2 else 3", "{(::$$ternary true {2} {3})}")
|
||||||
testParse("if 1 then {2} else {3}", "{(::$$ternary 1 {2} {3})}")
|
testParse("if false then {2} else {3}", "{(::$$ternary false {2} {3})}")
|
||||||
testParse(
|
testParse(
|
||||||
"if 1 then {2} else if 3 then {4} else {5}",
|
"if false then {2} else if false then {4} else {5}",
|
||||||
"{(::$$ternary 1 {2} (::$$ternary 3 {4} {5}))}",
|
"{(::$$ternary false {2} (::$$ternary false {4} {5}))}",
|
||||||
) //nested if
|
) //nested if
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user