~ubuntu-branches/debian/sid/libconfig-model-dpkg-perl/sid

« back to all changes in this revision

Viewing changes to t/scanner/squash_copyright_years.t

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont
  • Date: 2015-05-08 10:24:03 UTC
  • mfrom: (1.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150508102403-5a61zoujj1kqd7vw
Tags: 2.063
* Copyright scanner:
  * to cope with owner containing 'f00' (Closes: #783932)
  * handle ranges like 2010-12 or 2002-3 (Closes: #783928)
* Dpkg::Patch: fix handling of Subject body expressed as
  free form text below header.
* Updated list of supported arch in C::M::Dpkg::Dependency
  (Closes: #782995)
* control: added build-dep on libyaml-tiny-perl

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- cperl -*-
 
2
use strict;
 
3
use warnings;
 
4
use 5.010;
 
5
 
 
6
use Test::More;   # see done_testing()
 
7
use Test::Differences;
 
8
use YAML::Tiny;
 
9
 
 
10
require_ok( 'Dpkg::Copyright::Scanner' );
 
11
 
 
12
# __pack_copyright tests
 
13
my @tests = (
 
14
    [
 
15
        'dir with squashable copyright',
 
16
        "---
 
17
pan:
 
18
  data:
 
19
    article-cache.cc: 4
 
20
    article-cache.h: 4
 
21
    article.cc: 6
 
22
    article.h: 6
 
23
    cert-store.cc: 5
 
24
    data.cc: 4
 
25
    data.h: 4
 
26
",
 
27
        "---
 
28
pan:
 
29
  data:
 
30
    article-cache.cc: 4
 
31
    article-cache.h: 4
 
32
    article.cc: 10
 
33
    article.h: 10
 
34
    cert-store.cc: 10
 
35
    data.cc: 4
 
36
    data.h: 4
 
37
"    ],
 
38
);
 
39
 
 
40
my @copyright_by_id = (
 
41
    [ '2002, foo' , 'GPL' ],
 
42
    [ '2003, bar1', 'GPL' ],
 
43
    [ '2003, bar2', 'GPL' ],
 
44
    [ '2003, bar3', 'GPL' ],
 
45
    [ '2003, bar4', 'GPL' ],
 
46
    [ '2003, bar5', 'GPL' ],
 
47
    [ '2003, bar5', 'GPL' ],
 
48
    [ '2003, bar7', 'GPL' ],
 
49
    [ '2003, bar8', 'GPL' ],
 
50
    [ '2003, bar9', 'GPL' ]
 
51
);
 
52
 
 
53
 
 
54
 
 
55
foreach my $t (@tests) {
 
56
    my ($label,$in,$expect) = @$t;
 
57
    my $h = Load($in);
 
58
    my $info = Dpkg::Copyright::Scanner::__squash_copyrights_years(\@copyright_by_id);
 
59
    Dpkg::Copyright::Scanner::__swap_merged_ids($h, $info);
 
60
    eq_or_diff(
 
61
        $h,
 
62
        ref($expect) ? $expect : Load($expect),
 
63
        "__squash_copyrights_years $label"
 
64
    );
 
65
}
 
66
 
 
67
 
 
68
done_testing();