diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 14:24:54 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-04 14:24:54 +0000 |
commit | 714fceaa4d00776f857edf628587a6786a1468ea (patch) | |
tree | 230adefa7417411d45079f847a4d4fe5cff30f9c /test | |
parent | ef8e303e8d49eae31e67409d82d02fdfd96c41a7 (diff) | |
download | ruby-714fceaa4d00776f857edf628587a6786a1468ea.tar.gz ruby-714fceaa4d00776f857edf628587a6786a1468ea.tar.xz ruby-714fceaa4d00776f857edf628587a6786a1468ea.zip |
* lib/open3.rb (Open3.poutput3): new method.
(Open3.poutput2): ditto.
(Open3.poutput2e): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/test_open3.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_open3.rb b/test/test_open3.rb index 7d45eb543..5acc1c39e 100644 --- a/test/test_open3.rb +++ b/test/test_open3.rb @@ -123,6 +123,32 @@ class TestOpen3 < Test::Unit::TestCase } end + def test_poutput3 + o, e, s = Open3.poutput3(RUBY, '-e', 'i=STDIN.read; print i+"o"; STDOUT.flush; STDERR.print i+"e"', :stdin_data=>"i") + assert_equal("io", o) + assert_equal("ie", e) + assert(s.success?) + end + + def test_poutput3_flip + o, e, s = Open3.poutput3(RUBY, '-e', 'STDOUT.sync=true; 1000.times { print "o"*1000; STDERR.print "e"*1000 }') + assert_equal("o"*1000000, o) + assert_equal("e"*1000000, e) + assert(s.success?) + end + + def test_poutput2 + o, s = Open3.poutput2(RUBY, '-e', 'i=STDIN.read; print i+"o"', :stdin_data=>"i") + assert_equal("io", o) + assert(s.success?) + end + + def test_poutput2e + oe, s = Open3.poutput2e(RUBY, '-e', 'i=STDIN.read; print i+"o"; STDOUT.flush; STDERR.print i+"e"', :stdin_data=>"i") + assert_equal("ioie", oe) + assert(s.success?) + end + def test_pipeline_rw Open3.pipeline_rw([RUBY, '-e', 'print STDIN.read + "1"'], [RUBY, '-e', 'print STDIN.read + "2"']) {|i,o,ts| |