Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
add a test of io.popen (mode write)
Browse files Browse the repository at this point in the history
  • Loading branch information
fperrad committed May 26, 2009
1 parent cb23d8e commit 5b5682d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions t/io.t
Expand Up @@ -25,7 +25,7 @@ use warnings;
use FindBin;
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin";

use Parrot::Test tests => 41;
use Parrot::Test tests => 42;
use Test::More;
use Parrot::Test::Lua;

Expand Down Expand Up @@ -149,7 +149,7 @@ CODE
OUTPUT
unlink("$FindBin::Bin/../../../output.new") if ( -f "$FindBin::Bin/../../../output.new" );

language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.popen' );
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.popen (read)' );
f = io.popen("perl -e \"print 'standard output'\"")
print(io.type(f))
print(f:read())
Expand All @@ -159,6 +159,16 @@ file
standard output
OUTPUT

language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.popen (write)' );
f = io.popen("perl -pe \"s/e/a/\"", "w")
print(io.type(f))
f:write("hello\n")
f:close()
CODE
file
hallo
OUTPUT

language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'io.read *l', params => '< file.txt' );
print(io.read("*l"))
print(io.read("*l"))
Expand Down

0 comments on commit 5b5682d

Please sign in to comment.