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
|
# -*- cperl -*-
use ExtUtils::testlib;
use Test::More ;
use Test::Memory::Cycle;
use Config::Model ;
use Config::Model::Tester::Setup qw/init_test setup_test_dir/;
use Path::Tiny;
use 5.10.0;
use warnings;
use strict;
my ($model, $trace) = init_test();
my $wr_dir = setup_test_dir();
$wr_dir->child("debian")->mkpath() ;
# instance to check one dependency at a time
my $unit = $model->instance (
root_class_name => 'Dpkg::Copyright',
root_dir => $wr_dir,
instance_name => "unittest",
)->config_root;
is($unit->instance->initial_load,0,"initial load is done");
my $pan = path('t/scanner/examples/pan.in') ;
$unit->update(in => $pan, quiet => 1);
my $gpl_text = $unit->grab("License:GPL-2 text");
# should be undef
my $default = $gpl_text->fetch() ;
like($default,qr/GNU/,"check license text brought by Software::License");
is($gpl_text->fetch(mode => 'custom'),undef,'check lic text');
is($gpl_text->fetch_custom,undef,'check lic text');
# store identical text
$unit->instance->initial_load_start;
$gpl_text->store($default);
$unit->instance->initial_load_stop;
# custom text should still be undef
is($gpl_text->fetch_custom,undef,'check lic text');
# re-test with a debian/pan.copyright-tweak file
# re-check som
memory_cycle_ok($model, "memory cycles");
done_testing;
|