mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 18:59:06 +02:00
Show error when trying to sort by invalid column (#1880)
* Show error when trying to sort by invalid column * Added test for changes * Addressed comments, updated test * Removed unnecessary mutable keyword * Changed split-column to solt column after rebase from upstream
This commit is contained in:
@ -22,6 +22,29 @@ fn by_column() {
|
||||
assert_eq!(actual.out, "description");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn by_invalid_column() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open cargo_sample.toml --raw
|
||||
| lines
|
||||
| skip 1
|
||||
| first 4
|
||||
| split column "="
|
||||
| sort-by ColumnThatDoesNotExist
|
||||
| skip 1
|
||||
| first 1
|
||||
| get Column1
|
||||
| trim
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("Can not find column to sort by"));
|
||||
assert!(actual.err.contains("invalid column"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sort_primitive_values() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user