зеркало из https://github.com/github/ruby.git
Update to ruby/spec@681e8cf
This commit is contained in:
Родитель
31636bbddc
Коммит
8dab56ea86
|
@ -9,7 +9,7 @@ describe "An Exception reaching the top level" do
|
|||
it "the Exception#cause is printed to STDERR with backtraces" do
|
||||
code = <<-RUBY
|
||||
def raise_cause
|
||||
raise "the cause"
|
||||
raise "the cause"
|
||||
end
|
||||
def raise_wrapped
|
||||
raise "wrapped"
|
||||
|
@ -22,7 +22,7 @@ describe "An Exception reaching the top level" do
|
|||
RUBY
|
||||
lines = ruby_exe(code, args: "2>&1").lines
|
||||
lines.reject! { |l| l.include?('rescue in') }
|
||||
lines.map! { |l| l.split(':')[2..-1].join(':').chomp }
|
||||
lines.map! { |l| l.chomp[/:(in.+)/, 1] }
|
||||
lines.should == ["in `raise_wrapped': wrapped (RuntimeError)",
|
||||
"in `<main>'",
|
||||
"in `raise_cause': the cause (RuntimeError)",
|
||||
|
|
|
@ -536,12 +536,14 @@ describe "Process.spawn" do
|
|||
File.read(@name).should == "glarkbang"
|
||||
end
|
||||
|
||||
it "closes STDERR in the child if :err => :close" do
|
||||
File.open(@name, 'w') do |file|
|
||||
-> do
|
||||
code = "begin; STDOUT.puts 'out'; STDERR.puts 'hello'; rescue => e; puts 'rescued'; end"
|
||||
Process.wait Process.spawn(ruby_cmd(code), :out => file, :err => :close)
|
||||
end.should output_to_fd("out\nrescued\n", file)
|
||||
platform_is_not :windows do
|
||||
it "closes STDERR in the child if :err => :close" do
|
||||
File.open(@name, 'w') do |file|
|
||||
-> do
|
||||
code = "begin; STDOUT.puts 'out'; STDERR.puts 'hello'; rescue => e; puts 'rescued'; end"
|
||||
Process.wait Process.spawn(ruby_cmd(code), :out => file, :err => :close)
|
||||
end.should output_to_fd("out\nrescued\n", file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче