diff options
| author | ksss <[email protected]> | 2016-08-07 15:58:39 +0900 |
|---|---|---|
| committer | ksss <[email protected]> | 2016-08-07 21:21:01 +0900 |
| commit | b462ef450665141a38978d5b31b5550a60db4e6b (patch) | |
| tree | aee07c67b90f27d02d40d1a61329664eb44bf188 /test | |
| parent | 93d481d4b49829e37b1f501c7307663c6327dfab (diff) | |
| download | mruby-b462ef450665141a38978d5b31b5550a60db4e6b.tar.gz mruby-b462ef450665141a38978d5b31b5550a60db4e6b.zip | |
Enable option :in, :out, :err
Diffstat (limited to 'test')
| -rw-r--r-- | test/io.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/io.rb b/test/io.rb index f0f30e3ce..6e1bcb247 100644 --- a/test/io.rb +++ b/test/io.rb @@ -393,6 +393,43 @@ assert('IO.popen') do end end +assert('IO.popen with in option') do + begin + IO.pipe do |r, w| + w.write 'hello' + w.close + assert_equal "hello", IO.popen("cat", "r", in: r) { |i| i.read } + assert_equal "", r.read + end + rescue NotImplementedError => e + skip e.message + end +end + +assert('IO.popen with out option') do + begin + IO.pipe do |r, w| + IO.popen("echo 'hello'", "w", out: w) {} + w.close + assert_equal "hello\n", r.read + end + rescue NotImplementedError => e + skip e.message + end +end + +assert('IO.popen with err option') do + begin + IO.pipe do |r, w| + assert_equal "", IO.popen("echo 'hello' 1>&2", "r", err: w) { |i| i.read } + w.close + assert_equal "hello\n", r.read + end + rescue NotImplementedError => e + skip e.message + end +end + assert('IO.read') do # empty file fd = IO.sysopen $mrbtest_io_wfname, "w" |
