nu-command 0.112.2

Nushell's built-in commands
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use nu_test_support::prelude::*;

#[test]
fn const_max() -> Result {
    test()
        .run("const MAX = [1 3 5] | math max; $MAX")
        .expect_value_eq(5)
}

#[test]
fn cannot_max_infinite_range() -> Result {
    let outcome = test().run("0.. | math max").expect_shell_error()?;

    assert!(matches!(outcome, ShellError::IncorrectValue { .. }));
    Ok(())
}