mirror of
https://github.com/nushell/nushell
synced 2024-12-31 23:39:00 +00:00
96a1bf5f8d
* Change true/false to keywords * oops, clippy * Both kinds of bools * Add in some boolean variables * disable py virtualenv test for now
61 lines
1.1 KiB
Rust
61 lines
1.1 KiB
Rust
use crate::tests::{run_test, TestResult};
|
|
|
|
#[test]
|
|
fn if_test1() -> TestResult {
|
|
run_test("if true { 10 } else { 20 } ", "10")
|
|
}
|
|
|
|
#[test]
|
|
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 if_elseif1() -> TestResult {
|
|
run_test("if 2 > 3 { 5 } else if 6 < 7 { 4 } ", "4")
|
|
}
|
|
|
|
#[test]
|
|
fn if_elseif2() -> TestResult {
|
|
run_test("if 2 < 3 { 5 } else if 6 < 7 { 4 } else { 8 } ", "5")
|
|
}
|
|
|
|
#[test]
|
|
fn if_elseif3() -> TestResult {
|
|
run_test("if 2 > 3 { 5 } else if 6 > 7 { 4 } else { 8 } ", "8")
|
|
}
|
|
|
|
#[test]
|
|
fn if_elseif4() -> TestResult {
|
|
run_test("if 2 > 3 { 5 } else if 6 < 7 { 4 } else { 8 } ", "4")
|
|
}
|