-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.zp
80 lines (62 loc) · 2.44 KB
/
test.zp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
(load "semver/sv")
(load "minitest/minitest")
(import-all "semver" "sv")
(import-all "minitest")
((import "minitest:colorize") #t)
((import "minitest:verbose") #t)
(minitest:assert-equal
(semver:make-semantic-version 1 1 0 ">=")
(sv:parse ">=1.1.0")
"test we can parse a semantic version")
(minitest:assert-equal
(semver:make-semantic-version 2 10 3 (nil))
(sv:parse "2.10.3")
"test we can parse a semantic version without comparator")
(minitest:assert-true
(sv:valid? "<2.10.3")
"test we can validate a semantic version")
(minitest:assert-false
(sv:valid? "2.10.<3")
"test we can invalidate a semantic version")
(minitest:assert-true
(sv:gt (sv:parse "2.10.3") (sv:parse ">1.1.0"))
"test we can compare semantic versions with >")
(minitest:assert-true
(sv:lt (sv:parse "1.0.1") (sv:parse ">1.1.0"))
"test we can compare semantic versions with <")
(minitest:assert-true
(sv:ne (sv:parse "2.10.3") (sv:parse ">1.1.0"))
"test we can compare semantic versions with /=")
(minitest:assert-true
(sv:eq (sv:parse "1.1.0") (sv:parse "1.1.0"))
"test we can compare semantic versions with =")
(minitest:assert-true
(sv:ge (sv:parse "2.10.3") (sv:parse ">1.1.0"))
"test we can compare semantic versions with >= if they are not equal")
(minitest:assert-true
(sv:ge (sv:parse "1.1.0") (sv:parse "1.1.0"))
"test we can compare semantic versions with >= if they are equal")
(minitest:assert-true
(sv:le (sv:parse "1.0.3") (sv:parse "1.1.0"))
"test we can compare semantic versions with <= if they are not equal")
(minitest:assert-true
(sv:le (sv:parse "1.1.0") (sv:parse "1.1.0"))
"test we can compare semantic versions with <= if they are equal")
(minitest:assert-true
(sv:matches (sv:parse "1.1.0") (sv:parse "1.1.0"))
"test we can match equal semantic versions")
(minitest:assert-true
(sv:matches (sv:parse "1.1.1") (sv:parse ">1.1.0"))
"test we can match > semantic versions")
(minitest:assert-false
(sv:matches (sv:parse "1.0.9") (sv:parse ">1.1.0"))
"test we cannot match > semantic versions if they're not satisfied")
(minitest:assert-true
(sv:matches (sv:parse "1.1.1") (sv:parse ">=1.1.0"))
"test we can match <= semantic versions")
(minitest:assert-true
(sv:matches (sv:parse "1.1.0") (sv:parse ">=1.1.0"))
"test we can match <= semantic versions on equality")
(minitest:assert-false
(sv:matches (sv:parse "1.0.9") (sv:parse ">=1.1.0"))
"test we cannot match <= semantic versions if they're not satisfied")