Permalink
Browse files

t/run/options.t: test -w/--warnings

  • Loading branch information...
1 parent 060691d commit 2e9048c15c7b44bffbfe56dc2a2c769a340ebff8 @Benabik Benabik committed Jan 28, 2012
Showing with 26 additions and 1 deletion.
  1. +26 −1 t/run/options.t
View
@@ -19,7 +19,7 @@ use strict;
use warnings;
use lib qw( lib . ../lib ../../lib );
-use Test::More tests => 53;
+use Test::More tests => 56;
use Parrot::Config;
use File::Temp 0.13 qw/tempfile/;
use File::Spec;
@@ -144,6 +144,31 @@ for my $hash ('--hash-seed ', '--hash-seed=') {
"$hash takes a hex value" );
}
+# Test -w/--warnings
+{
+ # Create a simple file that throws an Undef warning.
+ my ($fh, $filename) = tempfile( UNLINK => 0, SUFFIX => '.pir', UNLINK => 1 );
+ print $fh <<'END_PIR';
+.sub 'main' :main
+ $P0 = new 'Undef'
+ $S0 = $P0
+.end
+END_PIR
+ close $fh;
+
+ unlike( qx{"$PARROT" "$filename" 2>&1}, qr/Undef/,
+ 'no complaint without warning flag' );
+
+ for my $w ('-w', '--warnings') {
+ like( qx{"$PARROT" $w "$filename" 2>&1}, qr/Undef/,
+ "$w warns about Undef" );
+ }
+
+ unlink $filename;
+}
+
+
+
# clean up temporary files
unlink $first_pir_file;
unlink $second_pir_file;

0 comments on commit 2e9048c

Please sign in to comment.