about summary refs log blame commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-compareVersions.nix
blob: 4c3ed5987509507bf0ff2c759125d40288d79b87 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                          
 









                        
 
let
  cmp = a: b:
    let
      ord1 = builtins.compareVersions a b;
      ord2 = builtins.compareVersions b a;
    in
      assert ord1 == -ord2; ord1;
in

[
  (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" "")
]