Make comparisons/sort-by more 'global' (#4500)

* Make comparisons/sort-by more 'global'

* Let custom values do their own comparisons
This commit is contained in:
JT
2022-02-16 14:30:37 -05:00
committed by GitHub
parent b64ac9eb7b
commit d620f76a21
7 changed files with 325 additions and 45 deletions

View File

@ -146,3 +146,16 @@ fn ls_sort_by_type_name_insensitive() {
let json_output = r#"[{"name": "C","type": "Dir"},{"name": "a.txt","type": "File"},{"name": "B.txt","type": "File"}]"#;
assert_eq!(actual.out, json_output);
}
#[test]
fn sort_different_types() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
[a, 1, b, 2, c, 3, [4, 5, 6], d, 4, [1, 2, 3]] | sort-by | to json --raw
"#
));
let json_output = r#"[1,2,3,4,"a","b","c","d",[1,2,3],[4,5,6]]"#;
assert_eq!(actual.out, json_output);
}