diff options
author | Dominique Dumont <dod@debian.org> | 2021-03-20 18:51:56 +0100 |
---|---|---|
committer | Dominique Dumont <dod@debian.org> | 2021-03-21 18:54:41 +0100 |
commit | 7260d1e60588055abbcde45b7ccab83098a24a6d (patch) | |
tree | 601809df3864d8c494670fb35393806fadea9621 | |
parent | 3544e320201fc105bbe8eb497ad2a39ce446c344 (diff) |
test change notif when fixing lintian tags
-rw-r--r-- | t/lintian.t | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/t/lintian.t b/t/lintian.t index ea2a89a6..53ca56cd 100644 --- a/t/lintian.t +++ b/t/lintian.t @@ -10,19 +10,59 @@ use 5.10.0; use Test::More; use Test::Exception; # use Test::LongString; +use Test::Log::Log4perl; + +$::_use_log4perl_to_warn = 1; use lib "../lib"; use Config::Model::Dpkg::Lintian::Overrides; -ok(Config::Model::Dpkg::Lintian::Overrides::_exists('debian-changelog-contains-hint'), - "check known tag"); +subtest "load of tag data from lintian files" => sub { + ok(Config::Model::Dpkg::Lintian::Overrides::_exists('debian-changelog-contains-hint'), + "check known tag"); + + ok(! Config::Model::Dpkg::Lintian::Overrides::_exists('shlib-calls-exit'), + "check unknown tag"); + + is(Config::Model::Dpkg::Lintian::Overrides::_new_name('shlib-calls-exit'), + 'exit-in-shared-library', "check renamed tag"); +}; + +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 ; -ok(! Config::Model::Dpkg::Lintian::Overrides::_exists('shlib-calls-exit'), - "check unknown tag"); +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"!); +}; -is(Config::Model::Dpkg::Lintian::Overrides::_new_name('shlib-calls-exit'), - 'exit-in-shared-library', "check renamed tag"); +$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(); |