From 11f04eaa4a97e78d8c8c11a63fff221e4935a13d Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 13 Jun 2013 15:45:11 -0400 Subject: [PATCH] Test for an MFHD warning in 14-OpenILS-Utils.t 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 Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/extras/Makefile.install | 2 ++ Open-ILS/src/perlmods/t/14-OpenILS-Utils.t | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/extras/Makefile.install b/Open-ILS/src/extras/Makefile.install index c5aacd6590..c94cf4b6db 100644 --- a/Open-ILS/src/extras/Makefile.install +++ b/Open-ILS/src/extras/Makefile.install @@ -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 \ diff --git a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t index 209a48b506..621c98fdfc 100644 --- a/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t +++ b/Open-ILS/src/perlmods/t/14-OpenILS-Utils.t @@ -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')); -- 2.11.0