about summary refs log tree commit diff
path: root/tvix/eval/src/tests/nix_tests/eval-okay-sort.nix
blob: 50aa78e40325c1631407e05fda30364c69e24b9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
with builtins;

[ (sort lessThan [ 483 249 526 147 42 77 ])
  (sort (x: y: y < x) [ 483 249 526 147 42 77 ])
  (sort lessThan [ "foo" "bar" "xyzzy" "fnord" ])
  (sort (x: y: x.key < y.key)
    [ { key = 1; value = "foo"; } { key = 2; value = "bar"; } { key = 1; value = "fnord"; } ])
  (sort lessThan [
    [ 1 6 ]
    [ ]
    [ 2 3 ]
    [ 3 ]
    [ 1 5 ]
    [ 2 ]
    [ 1 ]
    [ ]
    [ 1 4 ]
    [ 3 ]
  ])
]