Fail if test_hook cannot be run

This commit is contained in:
Sven Weidauer 2022-06-06 10:58:40 +02:00
parent f4657ba967
commit 47363ad14b

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'English'
describe 'Test Hook' do
it 'adds spaces around =' do
out = run 'a=b'
@ -13,10 +15,14 @@ describe 'Test Hook' do
end
def run(input)
IO.popen ['ruby', "#{__dir__}/test_hook.rb"], mode: File::RDWR do |io|
result = IO.popen ['ruby', "#{__dir__}/test_hook.rb"], mode: File::RDWR do |io|
io.write input
io.close_write
io.read.chomp
end
raise 'Cannot run test_hook.rb' unless $CHILD_STATUS.success?
result
end
end