Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve integration spec #250

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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