Fix condition parsing for if

This commit is contained in:
JT
2021-08-27 09:48:27 +12:00
parent 2f91aca897
commit 5dd5a89775
3 changed files with 122 additions and 27 deletions

View File

@ -79,6 +79,36 @@ fn if_test2() -> TestResult {
run_test("if $false { 10 } else { 20 } ", "20")
}
#[test]
fn simple_if() -> TestResult {
run_test("if $true { 10 } ", "10")
}
#[test]
fn simple_if2() -> TestResult {
run_test("if $false { 10 } ", "")
}
#[test]
fn if_cond() -> TestResult {
run_test("if 2 < 3 { 3 } ", "3")
}
#[test]
fn if_cond2() -> TestResult {
run_test("if 2 > 3 { 3 } ", "")
}
#[test]
fn if_cond3() -> TestResult {
run_test("if 2 < 3 { 5 } else { 4 } ", "5")
}
#[test]
fn if_cond4() -> TestResult {
run_test("if 2 > 3 { 5 } else { 4 } ", "4")
}
#[test]
fn no_scope_leak1() -> TestResult {
fail_test(