Author: bernhard
Date: Sat Jan 28 09:21:14 2006
New Revision: 11362

Modified:
   trunk/t/examples/pir.t
Log:
Skip testing quine_ord.pir, when there is no File::Slurp


Modified: trunk/t/examples/pir.t
==============================================================================
--- trunk/t/examples/pir.t      (original)
+++ trunk/t/examples/pir.t      Sat Jan 28 09:21:14 2006
@@ -5,12 +5,19 @@
 use strict;
 use warnings;
 use lib qw( . lib ../lib ../../lib );
+use vars qw( $has_file_slurp );
 
-use File::Slurp qw( slurp );
 use Test::More;
 use Parrot::Test tests => 19;
 use Parrot::Config;
 
+BEGIN {
+    $has_file_slurp = 1;
+    eval "use File::Slurp;";
+    if ($@) {
+        $has_file_slurp = 0;
+    }
+}
 
 =head1 NAME
 
@@ -187,13 +194,18 @@ solved
 END_EXPECTED
     );
 
-# The expected output of a quine is the quine itself
-$expected{'quine_ord.pir'} = slurp( 'examples/pir/quine_ord.pir' );
-
 while ( my ( $example, $expected ) = each %expected ) {
     example_output_is( "examples/pir/$example", $expected );
 }
 
+SKIP: {
+   skip "File::Slurp not available", 1 unless $has_file_slurp;
+
+   my $quine_fn   = "examples/pir/quine_ord.pir";
+   my $quine_code = File::Slurp::slurp( $quine_fn );
+   example_output_is( $quine_fn, $quine_code );
+};
+
 my $PARROT = ".$PConfig{slash}$PConfig{test_prog}";
 
 # For testing life.pir, the number of generations should be small,

Reply via email to