nushell/tests/repl/test_ranges.rs
francesco-gaglione c4dca5fe03
Merged tests to produce a single binary (#12826)
This PR should close #7147 

# Description
Merged src/tests into /tests to produce a single binary.

![image](https://github.com/nushell/nushell/assets/94604837/84726469-d447-4619-b6d1-2d1415d0f42e)

# 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>
2024-05-13 13:37:53 +00:00

36 lines
747 B
Rust

use crate::repl::tests::{fail_test, run_test, TestResult};
#[test]
fn int_in_inc_range() -> TestResult {
run_test(r#"1 in -4..9.42"#, "true")
}
#[test]
fn int_in_dec_range() -> TestResult {
run_test(r#"1 in 9.42..-4"#, "true")
}
#[test]
fn int_in_exclusive_range() -> TestResult {
run_test(r#"3 in 0..<3"#, "false")
}
#[test]
fn non_number_in_range() -> TestResult {
fail_test(r#"'a' in 1..3"#, "subset comparison is not supported")
}
#[test]
fn float_not_in_inc_range() -> TestResult {
run_test(r#"1.4 not-in 2..9.42"#, "true")
}
#[test]
fn range_and_reduction() -> TestResult {
run_test(r#"1..6..36 | math sum"#, "148")
}
#[test]
fn zip_ranges() -> TestResult {
run_test(r#"1..3 | zip 4..6 | get 2.1"#, "6")
}