about summary refs log tree commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix')
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix29
1 files changed, 19 insertions, 10 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
index 769de79ad583..4c3ed5987509 100644
--- a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
@@ -1,12 +1,21 @@
+let
+  cmp = a: b:
+    let
+      ord1 = builtins.compareVersions a b;
+      ord2 = builtins.compareVersions b a;
+    in
+      assert ord1 == -ord2; ord1;
+in
+
 [
-  (builtins.compareVersions "1.2.3" "1.2.3")
-  (builtins.compareVersions "1.2.2" "1.2.3")
-  (builtins.compareVersions "1.2.3" "1.2.40")
-  (builtins.compareVersions "1.2.3" ".1.2.3")
-  (builtins.compareVersions "1.2.3" "1..2.3")
-  (builtins.compareVersions "1.2.3" "1.2.3.")
-  (builtins.compareVersions "1.2.3" "1.2")
-  (builtins.compareVersions "1.2.3" "1.2.a")
-  (builtins.compareVersions "1a.b" "1a.2")
-  (builtins.compareVersions "1" "")
+  (cmp "1.2.3" "1.2.3")
+  (cmp "1.2.2" "1.2.3")
+  (cmp "1.2.3" "1.2.40")
+  (cmp "1.2.3" ".1.2.3")
+  (cmp "1.2.3" "1..2.3")
+  (cmp "1.2.3" "1.2.3.")
+  (cmp "1.2.3" "1.2")
+  (cmp "1.2.3" "1.2.a")
+  (cmp "1a.b" "1a.2")
+  (cmp "1" "")
 ]