This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest/t/utf8_setup.pl: Make sure diagnostics are on separate lines
authorKarl Williamson <khw@cpan.org>
Thu, 15 Jun 2017 18:01:15 +0000 (12:01 -0600)
committerKarl Williamson <khw@cpan.org>
Thu, 13 Jul 2017 03:14:23 +0000 (21:14 -0600)
This changes diagnostic output to guarantee each element of the array
starts on a new line, for easier readability.  The array may or may not
already have terminating \n characters in the elements.

ext/XS-APItest/t/utf8_setup.pl

index 2f676a3..dd3992d 100644 (file)
@@ -19,7 +19,13 @@ sub display_bytes {
 }
 
 sub output_warnings(@) {
-    diag "The warnings were:\n" . join("", @_);
+    my @list = @_;
+    if (@list) {
+        diag "The warnings were:\n" . join "\n", map { chomp; $_ } @list;
+    }
+    else {
+        diag "No warnings were raised";
+    }
 }
 
 sub start_byte_to_cont($) {