File: 10_lyon.t

package info (click to toggle)
libversion-perl 1%3A0.9928-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 832 kB
  • sloc: perl: 2,154; ansic: 1,021; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 1,596 bytes parent folder | download | duplicates (5)
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
#! perl

use Test::More qw/no_plan/;

use version;

# These values are from the Lyon consensus, as taken from
# https://gist.github.com/dagolden/9559280

ok('version'->new(1.0203) == 'version'->new('1.0203'));
ok('version'->new(1.02_03) == 'version'->new('1.02_03'));
ok('version'->new(v1.2.3) == 'version'->new('v1.2.3'));
if ($] >= 5.008_001) {
    ok('version'->new(v1.2.3_0) == 'version'->new('v1.2.3_0'));
}

cmp_ok('version'->new(1.0203), '==', 'version'->new('1.0203'));
cmp_ok('version'->new(1.02_03), '==', 'version'->new('1.02_03'));
cmp_ok('version'->new(v1.2.3), '==', 'version'->new('v1.2.3'));
if ($] >= 5.008_001) {
    cmp_ok('version'->new(v1.2.3_0), '==', 'version'->new('v1.2.3_0'));
}

cmp_ok('version'->new('1.0203')->numify, '==', '1.0203');
is('version'->new('1.0203')->normal, 'v1.20.300');

cmp_ok('version'->new('1.02_03')->numify, '==', '1.0203');
is('version'->new('1.02_03')->normal, 'v1.20.300');

cmp_ok('version'->new('v1.2.30')->numify, '==', '1.002030');
is('version'->new('v1.2.30')->normal, 'v1.2.30');
cmp_ok('version'->new('v1.2.3_0')->numify, '==', '1.002030');
is('version'->new('v1.2.3_0')->normal, 'v1.2.30');

is('version'->new("1.0203")->stringify, "1.0203");
is('version'->new("1.02_03")->stringify, "1.02_03");
is('version'->new("v1.2.30")->stringify, "v1.2.30");
is('version'->new("v1.2.3_0")->stringify, "v1.2.3_0");
is('version'->new(1.0203)->stringify, "1.0203");
is('version'->new(1.02_03)->stringify, "1.0203");
is('version'->new(v1.2.30)->stringify, "v1.2.30");
if ($] >= 5.008_001) {
    is('version'->new(v1.2.3_0)->stringify, "v1.2.30");
}