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

« back to all changes in this revision

Viewing changes to t/scanner/squash_files.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
my @tests = (
 
13
    [
 
14
        'dir with one file',
 
15
        "---
 
16
data-impl:
 
17
  defgroup.h: 1
 
18
",
 
19
        { '*' => '1' }
 
20
 
 
21
    ],
 
22
 
 
23
    [
 
24
        'dir with several files',
 
25
        "---
 
26
pan:
 
27
  data:
 
28
    article-cache.cc: 4
 
29
    article-cache.h: 4
 
30
    article.cc: 4
 
31
    article.h: 4
 
32
    cert-store.cc: 5
 
33
    cert-store.h: 5
 
34
    data.cc: 4
 
35
    data.h: 4
 
36
",
 
37
        "---
 
38
'*': '4'
 
39
pan:
 
40
  data:
 
41
    cert-store.cc: '5'
 
42
    cert-store.h: '5'
 
43
"    ],
 
44
    [
 
45
        'dir with subdirs',
 
46
        "---
 
47
pan:
 
48
  data:
 
49
    article-cache.cc: 4
 
50
    article-cache.h: 4
 
51
    article.cc: 4
 
52
    article.h: 4
 
53
    cert-store.cc: 5
 
54
    cert-store.h: 5
 
55
    data.cc: 4
 
56
    data.h: 4
 
57
uulib:
 
58
  crc32.c: 2
 
59
  crc32.h: 1
 
60
  fptools.c: 1
 
61
  fptools.h: 1
 
62
  uucheck.c: 0
 
63
  uudeview.h: 0
 
64
  uuencode.c: 0
 
65
  uuint.h: 0
 
66
",
 
67
        "---
 
68
'*': '0'
 
69
pan:
 
70
  '*': '4'
 
71
  data:
 
72
    cert-store.cc: '5'
 
73
    cert-store.h: '5'
 
74
uulib:
 
75
  crc32.c: '2'
 
76
  crc32.h: '1'
 
77
  fptools.c: '1'
 
78
  fptools.h: '1'
 
79
"    ],
 
80
);
 
81
 
 
82
=head 1
 
83
        "
 
84
---
 
85
'*': 0
 
86
pan:
 
87
  '*': 4
 
88
  data:
 
89
    cert-store.cc: 5
 
90
    cert-store.h: 5
 
91
    defgroup.h: 1
 
92
    parts.cc: 3
 
93
    parts.h: 3
 
94
  data-impl:
 
95
    defgroup.h: 1
 
96
  general:
 
97
    debug.cc: 1
 
98
    defgroup.h: 1
 
99
    e-util.cc: 8
 
100
    e-util.h: 8
 
101
  gui:
 
102
    action-manager.h: 1
 
103
    defgroup.h: 1
 
104
    e-action-combo-box.c: 18
 
105
    e-action-combo-box.h: 18
 
106
    e-charset-combo-box.c: 17
 
107
    e-charset-combo-box.h: 17
 
108
  icons:
 
109
    '*': 4
 
110
",
 
111
        [
 
112
            [ 0,'*'                                                             ],
 
113
            [ 4,'pan/*'                                                         ],
 
114
            [ 5,'pan/data/cert-store.cc','pan/data/cert-store.h'                ],
 
115
            [ 1,'pan/data/defgroup.h'                                           ],
 
116
            [ 3,'pan/data/parts.cc','pan/data/parts.h'                          ],
 
117
            [ 1,'pan/data-impl/defgroup.h'                                      ],
 
118
            [ 1,'pan/general/debug.cc','pan/general/defgroup.h'                 ],
 
119
            [ 8,'pan/general/e-util.cc','pan/general/e-util.h'                  ],
 
120
            [ 1,'pan/gui/action-manager.h','pan/gui/defgroup.h'                 ],
 
121
            [ 18,'pan/gui/e-action-combo-box.c','pan/gui/e-action-combo-box.h'  ],
 
122
            [ 17,'pan/gui/e-charset-combo-box.c','pan/gui/e-charset-combo-box.h'],
 
123
            [ 4,'pan/icons/*'                                                   ],
 
124
        ]
 
125
    ],
 
126
 
 
127
=cut
 
128
 
 
129
 
 
130
foreach my $t (@tests) {
 
131
    my ($label,$in,$expect) = @$t;
 
132
    my $res = Dpkg::Copyright::Scanner::__squash(Load($in));
 
133
    eq_or_diff(Dump($res),  ref($expect) ? Dump($expect) : $expect,"__squash $label");
 
134
}
 
135
 
 
136
 
 
137
done_testing();