Test for an MFHD warning in 14-OpenILS-Utils.t
authorJason Etheridge <jason@esilibrary.com>
Thu, 13 Jun 2013 19:45:11 +0000 (15:45 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 1 Aug 2013 15:17:07 +0000 (11:17 -0400)
Specifically "Cannot compress without pattern data, returning original holdings"

I also added Test::Warn to Makefile.install for Debian and Fedora.

--
Bill moved the @comp_holdings variable declaration outside of the
warning_like block to avoid a new warning:

Name "main::comp_holdings" used only once: possible typo at
t/14-OpenILS-Utils.t line 42.
---

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/extras/Makefile.install
Open-ILS/src/perlmods/t/14-OpenILS-Utils.t

index c5aacd6..c94cf4b 100644 (file)
@@ -82,6 +82,7 @@ DEBS =  \
        libole-storage-lite-perl\
        libspreadsheet-writeexcel-perl\
        libssh2-1-dev\
+       libtest-warn-perl\
        libtext-aspell-perl\
        libtext-csv-perl\
        libuniversal-require-perl\
@@ -153,6 +154,7 @@ FEDORA_RPMS = \
        perl-OLE-Storage_Lite \
        perl-RPC-XML \
        perl-Spreadsheet-WriteExcel \
+       perl-Test-Warn \
        perl-Text-Aspell \
        perl-Text-CSV \
        perl-Text-CSV_XS \
index 209a48b..621c98f 100644 (file)
@@ -1,6 +1,7 @@
 #!perl -T
 
-use Test::More tests => 29;
+use Test::More tests => 30;
+use Test::Warn;
 
 use_ok( 'OpenILS::Utils::Configure' );
 use_ok( 'OpenILS::Utils::Cronscript' );
@@ -33,7 +34,12 @@ $co_marc->append_fields(
 );
 my $co_mfhd = MFHD->new($co_marc);
 
-my @comp_holdings = $co_mfhd->get_compressed_holdings($co_mfhd->field('853'));
+my @comp_holdings;
+warning_like {
+    @comp_holdings = $co_mfhd->get_compressed_holdings($co_mfhd->field('853'));
+} [ qr/Cannot compress without pattern data, returning original holdings/ ],
+    "warning when attempting to compress holdings without a pattern";
+
 is(@comp_holdings, 0, "Compressed holdings for an MFHD record that only has a caption");
 
 my @decomp_holdings = $co_mfhd->get_decompressed_holdings($co_mfhd->field('853'));