Skip to content

Commit

Permalink
Merge pull request #250 from yui-knk/improve_integration_spec
Browse files Browse the repository at this point in the history
Improve integration spec
  • Loading branch information
yui-knk authored Nov 19, 2023
2 parents e6b6466 + 1b660c1 commit 8dccb39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/lrama/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ def test_parser(parser_name, input, expected, lrama_command_args: [], debug: fal
exec_command("#{flex} --header-file=#{lexer_h_path} -o #{lexer_c_path} #{lexer_file_path}")
exec_command("gcc -Wall -I#{tmpdir} #{parser_c_path} #{lexer_c_path} -o #{obj_path}")

out = err = nil
out = err = status = nil

Open3.popen3(obj_path, input) do |stdin, stdout, stderr, wait_thr|
out = stdout.read
err = stderr.read
status = wait_thr.value
end

STDERR.puts err if debug && !err.empty?
if debug
STDERR.puts out
STDERR.puts err
end
expect(status.success?).to be(true), status.to_s
expect(out).to eq(expected)
end

Expand Down

0 comments on commit 8dccb39

Please sign in to comment.