Add fail mode to test_hook.rb

This commit is contained in:
Sven Weidauer 2022-06-06 11:30:55 +02:00
parent 2e59062454
commit 8d8471951a
2 changed files with 5 additions and 0 deletions

View file

@ -4,6 +4,7 @@
output = []
$stdin.readlines.each do |line|
exit 0 if line.chomp == '#clear'
exit 1 if line.chomp == '#fail'
output << line.gsub(/([^\s]*)\s*=\s*(.*)/, '\1 = \2')
end

View file

@ -14,6 +14,10 @@ describe 'Test Hook' do
expect(out).to eq ''
end
it 'fails with a #fail line' do
expect { run '#fail' }.to raise_error
end
def run(input)
result = IO.popen ['ruby', "#{__dir__}/test_hook.rb"], mode: File::RDWR do |io|
io.write input