Return errors on unexpected inputs to take and first (#7123)

* Fix `take` behaviour for unexpected input types

* Fix `first` behaviour for unexpected input types

* Fix copy paste mistake
This commit is contained in:
Reilly Wood
2022-11-13 15:15:27 -08:00
committed by GitHub
parent 35f9299fc6
commit 336df6c65e
6 changed files with 177 additions and 168 deletions

View File

@ -79,3 +79,16 @@ fn gets_first_row_as_list_when_amount_given() {
assert_eq!(actual.out, "list<int>");
}
#[test]
// covers a situation where `first` used to behave strangely on list<binary> input
fn works_with_binary_list() {
let actual = nu!(
cwd: ".", pipeline(
r#"
([0x[01 11]] | first) == 0x[01 11]
"#
));
assert_eq!(actual.out, "true");
}