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:
Brian J. Cardiff 2020-08-15 12:09:53 -03:00 committed by GitHub
parent dfe7dca08f
commit a819d4792b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,12 +5,12 @@ private def run(code)
require "./src/kemal"
#{code}
CR
String.build do |stdout|
stderr = String.build do |io|
Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: io).wait
end
fail(stderr) unless stderr.empty?
end
stdout = IO::Memory.new
stderr = IO::Memory.new
status = Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: stderr).wait
fail(stderr.to_s) unless status.success?
stdout.to_s
end
describe "Run" do