Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (32 sloc) 1.652 kb
use v6;
use Test;
is v1.2.3, '1.2.3', 'version literal stringification';
is v1.2.3+, '1.2.3+', 'version literal stringification';
is v1.*.3, '1.*.3', 'version literal stringification';
ok v1.2.3 eqv v1.2.3, 'eqv works on version literals (+)';
nok v5.2.3 eqv v1.2.3, 'eqv works on version literals (-)';
nok v1.2+ eqv v1.2, '+ makes a difference in eqv';
ok v1.2 === v1.2, 'version literals are value types';
nok v1.2 === v1.3, '=== (-)';
ok v1.2 ~~ v1.2, 'smart-matching (same)';
nok v1.2 ~~ v6.2, 'smart-matching (different)';
ok v1.2.0 ~~ v1.2, 'smart-matching treats trailing 0 correctly (left)';
ok v1.2 ~~ v1.2.0, 'smart-matching treats trailing 0 correctly (right)';
ok v1.2 ~~ v1.0+, 'smart-matching and plus (+1)';
ok v1.2 ~~ v1.2+, 'smart-matching and plus (+2)';
ok v5 ~~ v1.2+, '+ scopes to the whole version, not just the last chunk';
ok v5.2.3 ~~ v5.2.*, '* wildcard (1+)';
ok v5.2 ~~ v5.2.*, '* wildcard (2+)';
nok v5.2.3 ~~ v5.3.*, '* wildcard (-)';
nok v1.2 ~~ v1.3+, 'smart-matching and plus (-)';
ok v1.2.3 ~~ v1, 'smart-matching only cares about the length of the LHS';
nok v1.2.3 ~~ v2, '... but it can still fail';
is v1.2 cmp v1.2, Same, 'cmp: Same';
is v1.2 cmp v3.2, Increase, 'cmp: Increase';
is v1.2 cmp v0.2, Decrease, 'cmp: Decrease';
is v1.2 cmp v1.10, Increase, "cmp isn't Stringy-based";
#?rakudo 3 todo "trailing zeroes fail"
ok v1.2 eqv v1.2.0, 'trailing zeroes are equivalent';
ok v1.2.0 eqv v1.2, 'trailing zeroes are equivalent';
ok v1.2.0 eqv v1.2.0.0.0.0.0, 'trailing zeroes are equivalent';
done;
Jump to Line
Something went wrong with that request. Please try again.