aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-28 18:39:00 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-28 18:39:39 +0200
commit76cc8e97a2cf3265b39cb6c1b444c7926871f6a0 (patch)
tree0c9ce19079a3e29b1deaec35df0ce916136566ad /tests
parent50807f3dd5241667dac0c0cc302042d648de4b42 (diff)
Add sort primop
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/eval-okay-sort.exp1
-rw-r--r--tests/lang/eval-okay-sort.nix8
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-sort.exp b/tests/lang/eval-okay-sort.exp
new file mode 100644
index 000000000..148b93516
--- /dev/null
+++ b/tests/lang/eval-okay-sort.exp
@@ -0,0 +1 @@
+[ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] ]
diff --git a/tests/lang/eval-okay-sort.nix b/tests/lang/eval-okay-sort.nix
new file mode 100644
index 000000000..8299c3a4a
--- /dev/null
+++ b/tests/lang/eval-okay-sort.nix
@@ -0,0 +1,8 @@
+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"; } ])
+]