mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 01:15:14 +02:00
Fix condition parsing for if
This commit is contained in:
30
src/tests.rs
30
src/tests.rs
@ -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(
|
||||
|
Reference in New Issue
Block a user