2023-07-17 16:43:51 +00:00
|
|
|
use nu_test_support::nu;
|
2020-08-16 03:16:49 +00:00
|
|
|
|
|
|
|
#[test]
|
2021-03-13 21:46:40 +00:00
|
|
|
fn length_columns_in_cal_table() {
|
2024-06-22 12:41:29 +00:00
|
|
|
let actual = nu!("cal --as-table | columns | length");
|
2020-08-16 03:16:49 +00:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "7");
|
|
|
|
}
|
2020-08-19 02:16:35 +00:00
|
|
|
|
|
|
|
#[test]
|
2021-03-13 21:46:40 +00:00
|
|
|
fn length_columns_no_rows() {
|
2023-08-23 21:03:26 +00:00
|
|
|
let actual = nu!("echo [] | length");
|
2020-08-19 02:16:35 +00:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "0");
|
|
|
|
}
|
2023-08-23 21:03:26 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn length_fails_on_echo_record() {
|
|
|
|
let actual = nu!("echo {a:1 b:2} | length");
|
|
|
|
|
2023-08-24 20:48:05 +00:00
|
|
|
assert!(actual.err.contains("only_supports_this_input_type"));
|
2023-08-23 21:03:26 +00:00
|
|
|
}
|