nu-command 0.112.1

Nushell's built-in commands
Documentation
use nu_test_support::prelude::*;

#[test]
fn const_log() -> Result {
    test()
        .run("const LOG = 16 | math log 2; $LOG")
        .expect_value_eq(4.0)
}

#[test]
fn can_log_range_into_list() -> Result {
    let expected: Value = test().run("[1 2 3 4 5] | math log 2")?;
    test().run("1..5 | math log 2").expect_value_eq(expected)
}

#[test]
fn cannot_log_infinite_range() -> Result {
    let outcome = test().run("1.. | math log 2").expect_shell_error()?;

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