Solving the issue "sort-by should fail gracefully if mismatched types are compared" (#2360)

This commit is contained in:
Luccas Mateus
2020-08-17 15:57:29 -03:00
committed by GitHub
parent e292bb46bb
commit a224cd38ab
2 changed files with 26 additions and 0 deletions

View File

@ -45,6 +45,21 @@ fn by_invalid_column() {
assert!(actual.err.contains("invalid column"));
}
#[test]
fn by_invalid_types() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open cargo_sample.toml --raw
| echo [1 "foo"]
| sort-by
"#
));
assert!(actual.err.contains("Not all values can be compared"));
assert!(actual.err.contains("not all values compare"));
}
#[test]
fn sort_primitive_values() {
let actual = nu!(