make first behave same way as last: always return list when with number argument (#6616)

* make `first` behave same way as `last`

* better behaviour

* fix tests

* add tests
This commit is contained in:
pwygab
2022-09-29 06:08:17 +08:00
committed by GitHub
parent dd578926c3
commit 32fbcf39cc
12 changed files with 44 additions and 16 deletions

View File

@ -64,3 +64,17 @@ fn requests_more_rows_than_table_has() {
assert_eq!(actual.out, "1");
}
#[test]
fn gets_last_row_as_list_when_amount_given() {
let actual = nu!(
cwd: ".", pipeline(
r#"
[1, 2, 3]
| last 1
| describe
"#
));
assert_eq!(actual.out, "list<int>");
}