]> diplodocus.org Git - flac-archive/commitdiff
test warnings
authorEric Gillespie <epg@pretzelnet.org>
Mon, 28 Mar 2022 03:33:04 +0000 (22:33 -0500)
committerEric Gillespie <epg@pretzelnet.org>
Mon, 28 Mar 2022 03:33:04 +0000 (22:33 -0500)
t/read_tags.t

index a47b3d0..d2331d0 100644 (file)
@@ -1,10 +1,11 @@
 use v5.12;
 use warnings;
 
-use Test::Simple tests => 7;
+use Test::More tests => 9;
 
 use Test::Differences;
 use Test::Exception;
+use Test::Warnings;
 
 require './tags.pl';
 epg::flac::archive::tags->import('read_tags');
@@ -72,28 +73,32 @@ Ricki Wilde, Producer
 Label : UMC (Universal Music Catalogue) - Universal Music\r
 
 EOF
-eq_or_diff
-    [read_tags($fh)],
-    [
-     {
-         ARTIST => ['Kim Wilde'],
-         ALBUM => ['Close'],
-         DISCNUMBER => ['1'],
-         DISCTOTAL => ['1'],
-         DATE => ['1988'],
-         GROUPING => ['Pop'],
-         COPYRIGHT => ['℗ 1988 MCA Records Ltd.'],
-         GENRE => ['Pop Rock'],
-         ALBUMARTIST => ['Kim Wilde'],
-         ARTIST => ['Kim Wilde'],
-         DESCRIPTION => ['Interprètes : Tony Swain, Producer'],
-         TITLE => ['You Came'],
-         TRACKNUMBER => ['2'],
-         TRACKTOTAL => ['10'],
-     },
-     [],
-    ],
-    'multiple lines in tag';
+my $warning = Test::Warnings::warning {
+    eq_or_diff
+      [ read_tags($fh) ],
+      [
+        {
+            ARTIST => ['Kim Wilde'],
+            ALBUM => ['Close'],
+            DISCNUMBER => ['1'],
+            DISCTOTAL => ['1'],
+            DATE => ['1988'],
+            GROUPING => ['Pop'],
+            COPYRIGHT => ['℗ 1988 MCA Records Ltd.'],
+            GENRE => ['Pop Rock'],
+            ALBUMARTIST => ['Kim Wilde'],
+            ARTIST => ['Kim Wilde'],
+            DESCRIPTION => ['Interprètes : Tony Swain, Producer'],
+            TITLE => ['You Came'],
+            TRACKNUMBER => ['2'],
+            TRACKTOTAL => ['10'],
+        },
+        [],
+      ],
+      'multiple lines in tag still works';
+};
+like($warning, qr/^looks like DESCRIPTION had multiple lines; discarding and returning early: /)
+  or diag 'got warning(s): ', explain($warning);
 
 $fh = str_file_handle(<<EOF);
 ARTIST=Marillion