From: Eric Gillespie Date: Mon, 28 Mar 2022 03:33:04 +0000 (-0500) Subject: test warnings X-Git-Url: https://diplodocus.org/git/flac-archive/commitdiff_plain/308b1816f4a6ee5278becd49cf5f0fee239fcbe6 test warnings --- diff --git a/t/read_tags.t b/t/read_tags.t index a47b3d0..d2331d0 100644 --- a/t/read_tags.t +++ b/t/read_tags.t @@ -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 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(<