diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-08-28 20:26:02 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-08-28 20:26:02 +0200 |
commit | b49307c701911a713cbdb48367833d3661a4880a (patch) | |
tree | 75674a3f22bee0b347b3efbbcc160bc7a637b8e3 /spec/ruby/core/io/readlines_spec.rb | |
parent | 3dd63108b0e7551aba76eba85a459b58ec971ccb (diff) |
Update to ruby/spec@335eb9b
Diffstat (limited to 'spec/ruby/core/io/readlines_spec.rb')
-rw-r--r-- | spec/ruby/core/io/readlines_spec.rb | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/spec/ruby/core/io/readlines_spec.rb b/spec/ruby/core/io/readlines_spec.rb index eb99eb8d3a..254f2927b5 100644 --- a/spec/ruby/core/io/readlines_spec.rb +++ b/spec/ruby/core/io/readlines_spec.rb @@ -101,31 +101,6 @@ describe "IO#readlines" do @io.readlines(obj).should == IOSpecs.lines_r_separator end end - - describe "when passed a string that starts with a |" do - it "gets data from the standard out of the subprocess" do - cmd = "|sh -c 'echo hello;echo line2'" - platform_is :windows do - cmd = "|cmd.exe /C echo hello&echo line2" - end - lines = IO.readlines(cmd) - lines.should == ["hello\n", "line2\n"] - end - - platform_is_not :windows do - it "gets data from a fork when passed -" do - lines = IO.readlines("|-") - - if lines # parent - lines.should == ["hello\n", "from a fork\n"] - else - puts "hello" - puts "from a fork" - exit! - end - end - end - end end describe "IO#readlines" do @@ -169,6 +144,31 @@ describe "IO.readlines" do $_.should == "test" end + describe "when passed a string that starts with a |" do + it "gets data from the standard out of the subprocess" do + cmd = "|sh -c 'echo hello;echo line2'" + platform_is :windows do + cmd = "|cmd.exe /C echo hello&echo line2" + end + lines = IO.readlines(cmd) + lines.should == ["hello\n", "line2\n"] + end + + platform_is_not :windows do + it "gets data from a fork when passed -" do + lines = IO.readlines("|-") + + if lines # parent + lines.should == ["hello\n", "from a fork\n"] + else + puts "hello" + puts "from a fork" + exit! + end + end + end + end + it_behaves_like :io_readlines, :readlines it_behaves_like :io_readlines_options_19, :readlines end |