cvsuser     04/05/16 13:19:30

  Modified:    t/pmc    io.t
  Log:
  t/pmc/io.t: move file checks to seperate function. No more globally enabled
    slurp-mode ($/=undef).
  
  Revision  Changes    Path
  1.26      +14 -17    parrot/t/pmc/io.t
  
  Index: io.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/io.t,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -w -r1.25 -r1.26
  --- io.t      16 Mar 2004 20:12:03 -0000      1.25
  +++ io.t      16 May 2004 20:19:30 -0000      1.26
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: io.t,v 1.25 2004/03/16 20:12:03 scog Exp $
  +# $Id: io.t,v 1.26 2004/05/16 20:19:30 boemmels Exp $
   
   =head1 NAME
   
  @@ -19,6 +19,16 @@
   use Parrot::Test tests => 23;
   use Test::More;
   
  +sub file_content_is {
  +    my ($file, $content, $name) = @_;
  +    local $/=undef; # slurp mode
  +    open FOO, "temp.file";
  +
  +    is(<FOO>, $content, $name);
  +
  +    close FOO;
  +}
  +
   output_is(<<'CODE', <<'OUTPUT', "open/close");
        open P0, "temp.file", ">"
        print P0, "a line\n"
  @@ -249,15 +259,10 @@
   done
   OUTPUT
   
  -$/=undef; # slurp mode
  -open FOO, "temp.file";
  -
  -is(<FOO>, <<'OUTPUT', 'file contents');
  +file_content_is("temp.file", <<'OUTPUT', 'file contents');
   Hello, World!
   OUTPUT
   
  -close FOO;
  -
   output_is(<<'CODE', '', 'append');
          open P1, "temp.file", ">>"
          print P1, "Parrot flies\n"
  @@ -265,15 +270,11 @@
          end
   CODE
   
  -open FOO, "temp.file";
  -
  -is(<FOO>, <<'OUTPUT', 'append file contents');
  +file_content_is("temp.file", <<'OUTPUT', 'append file contents');
   Hello, World!
   Parrot flies
   OUTPUT
   
  -close FOO;
  -
   output_is(<<'CODE', '', 'write to file');
          open P1, "temp.file", ">"
          print P1, "Parrot overwrites\n"
  @@ -281,13 +282,9 @@
          end
   CODE
   
  -open FOO, "temp.file";
  -
  -is(<FOO>, <<'OUTPUT', 'file contents');
  +file_content_is("temp.file", <<'OUTPUT', 'file contents');
   Parrot overwrites
   OUTPUT
  -
  -close FOO;
   
   unlink("temp.file");
   
  
  
  

Reply via email to