File: lintian.t

package info (click to toggle)
libconfig-model-dpkg-perl 3.014
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,200 kB
  • sloc: perl: 8,255; python: 242; makefile: 77; javascript: 16; sh: 1
file content (75 lines) | stat: -rw-r--r-- 1,911 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use strict;
use warnings;

use Config::Model;

use Config::Model::Tester::Setup qw/init_test setup_test_dir/;
use Path::Tiny;
use 5.10.0;

use Test::More;
use Test::Exception;
# use Test::LongString;
use Test::Log::Log4perl;


use lib "../lib";

use Config::Model::Dpkg::Lintian::Overrides;

subtest "load of tag data from lintian files" => sub {
    ok(Config::Model::Dpkg::Lintian::Overrides::_exists('binary-in-etc'),
       "check known tag");

    ok(! Config::Model::Dpkg::Lintian::Overrides::_exists('shlib-calls-exit'),
       "check unknown tag");

    my %replaced = (
        maintainer => 'mail-contact',
        uploader => 'mail-contact',
        'shlib-calls-exit' => 'exit-in-shared-library',
    );

    while (my ($key,$value) = each %replaced) {
        is(Config::Model::Dpkg::Lintian::Overrides::_new_name($key),
           $value, "check renamed tag ($key)");
    }
};

my $model = Config::Model->new ;
$model ->create_config_class (
    name => "TestClass",
    element => [
        'lintian-overrides' => {
            'type'       => 'leaf',
            'value_type' => 'string',
            class => 'Config::Model::Dpkg::Lintian::Overrides',
        },
    ],
) ;

my $inst = $model->instance(root_class_name => 'TestClass' );

my $root = $inst->config_root ;

subtest "load tag with obsolete value" => sub {
    my $xp = Test::Log::Log4perl->expect(
        ignore_priority => "info",
        ['User', warn =>  qr/Obsolete shlib-calls-exit tag/]
    );
    $root->load(q!lintian-overrides="libburn4 binary: shlib-calls-exit\n"!);
};

$inst->initial_load_stop;

subtest "fix and check change notification" => sub {
    $inst->apply_fixes;
    is( $inst->needs_save, 1, "verify instance needs_save after tag fix" );
    is(
        $root->grab_value(q!lintian-overrides!),
        "libburn4 binary: exit-in-shared-library\n",
        "check tag replacement"
    );
};

done_testing();