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

« back to all changes in this revision

Viewing changes to t/scanner/pack_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', 'data-impl/defgroup.h']] ,
 
20
    ],
 
21
    [
 
22
        'dir with several files',
 
23
        "---
 
24
data:
 
25
  cert-store.cc: 5
 
26
  cert-store.h: 5
 
27
  defgroup.h: 1
 
28
  parts.cc: 3
 
29
  parts.h: 3
 
30
",
 
31
        [
 
32
            [ 5, 'data/cert-store.cc', 'data/cert-store.h'],
 
33
            [ 1, 'data/defgroup.h'],
 
34
            [ 3, 'data/parts.cc', 'data/parts.h']
 
35
        ]
 
36
    ],
 
37
    [
 
38
        'dir with subdirs',
 
39
        "
 
40
---
 
41
'*': 0
 
42
pan:
 
43
  '*': 4
 
44
  data:
 
45
    cert-store.cc: 5
 
46
    cert-store.h: 5
 
47
    defgroup.h: 1
 
48
    parts.cc: 3
 
49
    parts.h: 3
 
50
  data-impl:
 
51
    defgroup.h: 1
 
52
  general:
 
53
    debug.cc: 1
 
54
    defgroup.h: 1
 
55
    e-util.cc: 8
 
56
    e-util.h: 8
 
57
  gui:
 
58
    action-manager.h: 1
 
59
    defgroup.h: 1
 
60
    e-action-combo-box.c: 18
 
61
    e-action-combo-box.h: 18
 
62
    e-charset-combo-box.c: 17
 
63
    e-charset-combo-box.h: 17
 
64
  icons:
 
65
    '*': 4
 
66
",
 
67
        [
 
68
            [ 0,'*'                                                             ],
 
69
            [ 4,'pan/*'                                                         ],
 
70
            [ 1,'pan/data-impl/defgroup.h'                                      ],
 
71
            [ 5,'pan/data/cert-store.cc','pan/data/cert-store.h'                ],
 
72
            [ 1,'pan/data/defgroup.h'                                           ],
 
73
            [ 3,'pan/data/parts.cc','pan/data/parts.h'                          ],
 
74
            [ 1,'pan/general/debug.cc','pan/general/defgroup.h'                 ],
 
75
            [ 8,'pan/general/e-util.cc','pan/general/e-util.h'                  ],
 
76
            [ 1,'pan/gui/action-manager.h','pan/gui/defgroup.h'                 ],
 
77
            [ 18,'pan/gui/e-action-combo-box.c','pan/gui/e-action-combo-box.h'  ],
 
78
            [ 17,'pan/gui/e-charset-combo-box.c','pan/gui/e-charset-combo-box.h'],
 
79
            [ 4,'pan/icons/*'                                                   ],
 
80
        ]
 
81
    ],
 
82
    [
 
83
        'interspersed copyrights',
 
84
        "---
 
85
include:
 
86
  SDL.h: 2
 
87
  SDL_copying.h: 2
 
88
  SDL_cpuinfo.h: 2
 
89
  SDL_egl.h: 3
 
90
  SDL_endian.h: 2
 
91
  SDL_mutex.h: 2
 
92
  SDL_name.h: 0
 
93
  SDL_opengl.h: 2
 
94
  SDL_opengles.h: 2
 
95
  SDL_opengles2.h: 3
 
96
  SDL_pixels.h: 2
 
97
  SDL_render.h: 2
 
98
  SDL_revision.h: 0
 
99
  SDL_rwops.h: 2
 
100
  close_code.h: 2
 
101
",
 
102
        [
 
103
           [ 2,'include/SDL.h','include/SDL_copying.h','include/SDL_cpuinfo.h','include/SDL_endian.h','include/SDL_mutex.h','include/SDL_opengl.h','include/SDL_opengles.h','include/SDL_pixels.h','include/SDL_render.h','include/SDL_rwops.h','include/close_code.h'],
 
104
           [ 3,'include/SDL_egl.h','include/SDL_opengles2.h'],
 
105
           [ 0,'include/SDL_name.h','include/SDL_revision.h'],
 
106
        ]
 
107
    ]
 
108
 
 
109
);
 
110
 
 
111
foreach my $t (@tests) {
 
112
    my ($label,$in,$expect) = @$t;
 
113
    my @res = Dpkg::Copyright::Scanner::__pack_files(Load($in));
 
114
    eq_or_diff(\@res,$expect,"__pack_files $label");
 
115
}
 
116
 
 
117
 
 
118
done_testing();