Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
basic tests for version literals and Version objects
  • Loading branch information
moritz committed May 12, 2012
1 parent 1ec0b65 commit 8cca77c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions S02-literals/version.t
@@ -0,0 +1,26 @@
use v6;
use Test;

is v1.2.3, 'v1.2.3', 'version literal stringification round-trips';
is v1.2.3+, 'v1.2.3+', 'version literal stringification with + round-trips';
is v1.*.3, 'v1.*.3', 'version literal stringification with * round-trips';
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 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';

done;

0 comments on commit 8cca77c

Please sign in to comment.