test(tvix/eval): assert flipped compareVersions behaves correctly
Change-Id: I7c239340de5c83a3124dc6a8ba0c70290466966d Reviewed-on: https://cl.tvl.fyi/c/depot/+/6698 Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
7506983ce2
commit
be18df1dab
1 changed files with 19 additions and 10 deletions
|
@ -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")
|
(cmp "1.2.3" "1.2.3")
|
||||||
(builtins.compareVersions "1.2.2" "1.2.3")
|
(cmp "1.2.2" "1.2.3")
|
||||||
(builtins.compareVersions "1.2.3" "1.2.40")
|
(cmp "1.2.3" "1.2.40")
|
||||||
(builtins.compareVersions "1.2.3" ".1.2.3")
|
(cmp "1.2.3" ".1.2.3")
|
||||||
(builtins.compareVersions "1.2.3" "1..2.3")
|
(cmp "1.2.3" "1..2.3")
|
||||||
(builtins.compareVersions "1.2.3" "1.2.3.")
|
(cmp "1.2.3" "1.2.3.")
|
||||||
(builtins.compareVersions "1.2.3" "1.2")
|
(cmp "1.2.3" "1.2")
|
||||||
(builtins.compareVersions "1.2.3" "1.2.a")
|
(cmp "1.2.3" "1.2.a")
|
||||||
(builtins.compareVersions "1a.b" "1a.2")
|
(cmp "1a.b" "1a.2")
|
||||||
(builtins.compareVersions "1" "")
|
(cmp "1" "")
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue