Refactor run_spec to use process exit instead of empty stderr (#584)
Bonus: It also allows run_spec to pass if using bin/crystal wrapper
This commit is contained in:
parent
dfe7dca08f
commit
a819d4792b
1 changed files with 6 additions and 6 deletions
|
@ -5,12 +5,12 @@ private def run(code)
|
||||||
require "./src/kemal"
|
require "./src/kemal"
|
||||||
#{code}
|
#{code}
|
||||||
CR
|
CR
|
||||||
String.build do |stdout|
|
|
||||||
stderr = String.build do |io|
|
stdout = IO::Memory.new
|
||||||
Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: io).wait
|
stderr = IO::Memory.new
|
||||||
end
|
status = Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: stderr).wait
|
||||||
fail(stderr) unless stderr.empty?
|
fail(stderr.to_s) unless status.success?
|
||||||
end
|
stdout.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Run" do
|
describe "Run" do
|
||||||
|
|
Loading…
Reference in a new issue