mirror of
https://github.com/nushell/nushell.git
synced 2024-11-08 01:24:38 +01:00
b6bdadbc6f
# Description * As discussed in the comments in #11954, this suppresses the index column on `cal` output. It does that by running `table -i false` on the results by default. * Added new `--as-table/-t` flag to revert to the old behavior and output the calendar as structured data * Updated existing tests to use `--as-table` * Added new tests against the string output * Updated `length` test which also used `cal` * Added new example for `--as-table`, with result # User-Facing Changes ## Breaking change The *default* `cal` output has changed from a `list` to a `string`. To obtain structured data from `cal`, use the new `--as-table/-t` flag. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
23 lines
444 B
Rust
23 lines
444 B
Rust
use nu_test_support::nu;
|
|
|
|
#[test]
|
|
fn length_columns_in_cal_table() {
|
|
let actual = nu!("cal --as-table | columns | length");
|
|
|
|
assert_eq!(actual.out, "7");
|
|
}
|
|
|
|
#[test]
|
|
fn length_columns_no_rows() {
|
|
let actual = nu!("echo [] | length");
|
|
|
|
assert_eq!(actual.out, "0");
|
|
}
|
|
|
|
#[test]
|
|
fn length_fails_on_echo_record() {
|
|
let actual = nu!("echo {a:1 b:2} | length");
|
|
|
|
assert!(actual.err.contains("only_supports_this_input_type"));
|
|
}
|