Skip to content

Commit 37470f3

Browse files
committed
Some more tests for the Version type.
1 parent 24916aa commit 37470f3

File tree

2 files changed

+62
-4
lines changed

2 files changed

+62
-4
lines changed

S02-literals/version.t

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ nok v5.2.3 ~~ v5.3.*, '* wildcard (-)';
2222
nok v1.2 ~~ v1.3+, 'smart-matching and plus (-)';
2323
ok v1.2.3 ~~ v1, 'smart-matching only cares about the length of the LHS';
2424
nok v1.2.3 ~~ v2, '... but it can still fail';
25-
is v1.2 cmp v1.2, Same, 'cmp: Same';
26-
is v1.2 cmp v3.2, Increase, 'cmp: Increase';
27-
is v1.2 cmp v0.2, Decrease, 'cmp: Decrease';
25+
is v1.2 cmp v1.2, Same, 'cmp: Same';
26+
is v1.2 cmp v3.2, Increase, 'cmp: Increase';
27+
is v1.2 cmp v0.2, Decrease, 'cmp: Decrease';
2828
#?rakudo todo "NYI"
29-
is v1.2 cmp v1.10, Increase, "cmp isn't Stringy-based";
29+
is v1.2 cmp v1.10, Increase, "cmp isn't Stringy-based";
30+
#?rakudo 3 todo "trailing zeroes fail"
31+
ok v1.2 eqv v1.2.0, 'trailing zeroes are equivalent';
32+
ok v1.2.0 eqv v1.2, 'trailing zeroes are equivalent';
33+
ok v1.2.0 eqv v1.2.0.0.0.0.0, 'trailing zeroes are equivalent';
3034

3135
done;
3236

S02-types/version.t

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use v6;
2+
use Test;
3+
4+
plan 35;
5+
6+
my sub vtest($cmp, *@v) {
7+
my $x = shift @v;
8+
while (@v) {
9+
my $y = shift @v;
10+
is Version.new($x) cmp Version.new($y), $cmp, "$x cmp $y is $cmp";
11+
$x = $y;
12+
}
13+
}
14+
15+
# From S03
16+
vtest Order::Same,
17+
< 1.2.1alpha1.0
18+
1.2.1alpha1
19+
1.2.1.alpha1
20+
1.2.1alpha.1
21+
1.2.1.alpha.1
22+
1.2-1+alpha/1 >;
23+
24+
# More from S03
25+
vtest Order::Same,
26+
< 1.2.1_01
27+
1.2.1_1
28+
1.2.1._1
29+
1.2.1_1
30+
1.2.1._.1
31+
001.0002.0000000001._.00000000001
32+
1.2.1._.1.0.0.0.0.0 >;
33+
34+
# Still more from S03
35+
my @sorted = <
36+
1.2.0.999
37+
1.2.1_01
38+
1.2.1_2
39+
1.2.1_003
40+
1.2.1a1
41+
1.2.1.alpha1
42+
1.2.1b1
43+
1.2.1.beta1
44+
1.2.1.gamma
45+
1.2.1α1
46+
1.2.1β1
47+
1.2.1γ
48+
1.2.1 >;
49+
50+
vtest Order::Increase, @sorted;
51+
vtest Order::Decrease, @sorted.reverse;
52+
53+
done;
54+

0 commit comments

Comments
 (0)