mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 08:20:25 +02:00
Merged tests to produce a single binary (#12826)
This PR should close #7147 # Description Merged src/tests into /tests to produce a single binary.  # User-Facing Changes No user facing changes # Tests + Formatting Moved tests. Tollkit check pr pass. # After Submitting --------- Co-authored-by: Ian Manske <ian.manske@pm.me>
This commit is contained in:
committed by
GitHub
parent
c70c43aae9
commit
c4dca5fe03
77
tests/repl/test_conditionals.rs
Normal file
77
tests/repl/test_conditionals.rs
Normal file
@@ -0,0 +1,77 @@
|
||||
use crate::repl::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")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mutation_in_else() -> TestResult {
|
||||
run_test(
|
||||
"mut x = 100; if 2 > 3 { $x = 200 } else { $x = 300 }; $x ",
|
||||
"300",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mutation_in_else2() -> TestResult {
|
||||
run_test(
|
||||
"mut x = 100; if 2 > 3 { $x = 200 } else if true { $x = 400 } else { $x = 300 }; $x ",
|
||||
"400",
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user