mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
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:
@ -65,3 +65,17 @@ fn gets_first_row_when_no_amount_given() {
|
||||
assert_eq!(actual.out, "1");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gets_first_row_as_list_when_amount_given() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[1, 2, 3]
|
||||
| first 1
|
||||
| describe
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "list<int>");
|
||||
}
|
||||
|
Reference in New Issue
Block a user