File: normalize.t

package info (click to toggle)
libgit-version-compare-perl 1.005-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 256; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,761 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;
use Test::More;
use Git::Version::Compare;

my @tests = (
    [ undef, undef ],

    # actual output from `git --version`
    [ '0.99.7',                             '00.99.07.00.00.0000' ],
    [ '0.99.9l',                            '00.99.09.12.00.0000' ],
    [ '1.2.3',                              '01.02.03.00.00.0000' ],
    [ '1.2.3',                              '01.02.03.00.00.0000' ],
    [ '1.8.0.rc3',                          '01.08.00.00-03.0000' ],
    [ '1.8.0',                              '01.08.00.00.00.0000' ],
    [ '1.8.0.3',                            '01.08.00.03.00.0000' ],
    [ '1.8.5.4.19.g5032098',                '01.08.05.04.00.0019' ],
    [ '2.3.0.rc0.36.g63a0e83',              '02.03.00.00-00.0036' ],
    [ "git version 2.7.0\n",                '02.07.00.00.00.0000' ],
    [ "git version 2.6.4 (Apple Git-63)\n", '02.06.04.00.00.0000' ],

    # Win32 msysgit
    [ '1.9.4.msysgit.0', '01.09.04.00.00.0000' ],
    [ '1.9.5.msysgit.1', '01.09.05.00.00.0000' ],

    # plausible version numbers
    [ '1.0.rc4', '00.99.09.12.00.0000' ],
    [ '1.0rc4',  '00.99.09.12.00.0000' ],
    [ '1.6',     '01.06.00.00.00.0000' ],

    # tags from git.git
    [ 'v1.0rc4',                '00.99.09.12.00.0000' ],
    [ 'v1.7.12-rc2',            '01.07.12.00-02.0000' ],
    [ 'v1.8.4.5',               '01.08.04.05.00.0000' ],
    [ 'v1.8.5.4-19-g5032098',   '01.08.05.04.00.0019' ],
    [ 'v2.0.0-rc0',             '02.00.00.00-00.0000' ],
    [ 'v1.5.3.7-971-g61fd255',  '01.05.03.07.00.0971' ],
    [ 'v1.5.3.7-1198-g467f42c', '01.05.03.07.00.1198' ],
);

plan tests => scalar @tests;

for my $t (@tests) {
    is( Git::Version::Compare::_normalize( $t->[0] ),
        $t->[1], $t->[0] || 'undef' );
}