From 13c2f44543caa45d40614449146826dc9c12c661 Mon Sep 17 00:00:00 2001 From: Mason James Date: Thu, 25 Apr 2013 04:16:25 +1200 Subject: [PATCH] Bug 10112 - add test for ./debian/control* files Content-Type: text/plain; charset="utf-8" to test, apply patch... 1/ install libparse-debcontrol-perl package apt-get install libparse-debcontrol-perl 2/ run successful tests $ perl ./t/00-valid-debian-control-file.t 1..2 ok 1 - parsed ./debian/control file cleanly ok 2 - parsed ./debian/control.in file cleanly 3/ add some bad syntax to a file $ sed -i -e '20i -------\' ./debian/control.in 4/ run failed tests $ perl ./t/00-valid-debian-control-file.t 1..2 ok 1 - parsed ./debian/control file cleanly not ok 2 - parsed ./debian/control.in file cleanly --- C4/Installer/PerlDependencies.pm | 5 +++++ debian/control | 1 + t/00-valid-debian-control-file.t | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 t/00-valid-debian-control-file.t diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index a9e0ba9..904567d 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -862,6 +862,11 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '0.07', }, + 'Parse::DebControl' => { + 'usage' => 'Test Debian control* files', + 'required' => '0', + 'min_ver' => '2.005', + }, }; 1; diff --git a/debian/control b/debian/control index 209828f..fe7b572 100644 --- a/debian/control +++ b/debian/control @@ -319,6 +319,7 @@ Depends: libalgorithm-checkdigits-perl, libnet-z3950-zoom-perl, libnumber-format-perl, libopenoffice-oodoc-perl, + libparse-debcontrol-perl libpath-tiny-perl, libpdf-api2-perl, libpdf-api2-simple-perl, diff --git a/t/00-valid-debian-control-file.t b/t/00-valid-debian-control-file.t new file mode 100644 index 0000000..e4d540f --- /dev/null +++ b/t/00-valid-debian-control-file.t @@ -0,0 +1,23 @@ +use Modern::Perl; +use Parse::DebControl; +use Test::More; + +plan tests => 2; + +my $parser = new Parse::DebControl; + +$parser->DEBUG(); + +my %opt = ( 'stripComments' => 1, ); + +my $rc; +eval { + + local $SIG{__WARN__} = sub { }; # perls arcane syntax to shush stderr?! + $rc = $parser->parse_file( './debian/control', \%opt ); +}; + +isnt( $rc, undef, "parsed ./debian/control file without errors" ); +isnt( $rc, undef, "parsed ./debian/control.in file without errors" ); + +1; -- 2.1.4