File: split-copyright.t

package info (click to toggle)
libsoftware-copyright-perl 0.015-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 300; makefile: 10
file content (32 lines) | stat: -rw-r--r-- 1,160 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
# -*- cperl -*-
use strict;
use warnings;
use 5.010;

use Test::More;   # see done_testing()
use Test::Differences;

require_ok( 'Software::Copyright::Statement' );

my @tests = (
    [ '2015, Jonathan Stowe', [ 'Jonathan Stowe', '2015']],
    [ 'Jonathan Stowe 2015-2021', [ 'Jonathan Stowe', '2015-2021']],
    [ 'Jonathan Stowe 2004, 2015-2021', [ 'Jonathan Stowe', '2004', '2015-2021']],
    [ 'Jonathan Stowe <jns+git@gellyfish.co.uk>', [ 'Jonathan Stowe <jns+git@gellyfish.co.uk>']],
    [ '2004-2015, Oliva f00 Oberto', [ 'Oliva f00 Oberto', '2004-2015']],
    [ 'Oliva f00 Oberto 2004-2015', [ 'Oliva f00 Oberto', '2004-2015']],
    [ 'Dümônt 2004-2015', [ 'Dümônt', '2004-2015']],
    [ 'Dominique Dumont', [ 'Dominique Dumont']],
    [ '2015, Dominique Dumont <dod@debian.org>', [ 'Dominique Dumont <dod@debian.org>', '2015']],
    [ '2021', [ '', '2021']],
    [ '', ['']],
);

foreach my $t (@tests) {
    my ($in,$expect) = @$t;
    my $label = length $in > 50 ? substr($in,0,30).'...' : $in ;
    my @res = Software::Copyright::Statement::__split_copyright($in);
    eq_or_diff(\@res,$expect,"__split_copyright '$label'");
}

done_testing();