Skip to content

Commit cc6b47a

Browse files
authored
Support RJIT (#281)
In Ruby 3.3, MJIT is replaced with RJIT.
1 parent 22e62bc commit cc6b47a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/csv/parse/test_general.rb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,22 @@ def test_seeked_string_io
323323
end
324324

325325
private
326-
def assert_parse_errors_out(data, **options)
326+
327+
{
328+
"YJIT"=>1, # for --yjit-call-threshold=1
329+
"MJIT"=>5, "RJIT"=>5, # for --jit-wait
330+
}.any? do |jit, timeout|
331+
if (RubyVM.const_defined?(jit) and
332+
jit = RubyVM.const_get(jit) and
333+
jit.respond_to?(:enabled?) and
334+
jit.enabled?)
335+
PARSE_ERROR_TIMEOUT = timeout
336+
end
337+
end
338+
PARSE_ERROR_TIMEOUT ||= 0.2
339+
340+
def assert_parse_errors_out(data, timeout: PARSE_ERROR_TIMEOUT, **options)
327341
assert_raise(CSV::MalformedCSVError) do
328-
timeout = 0.2
329-
if defined?(RubyVM::YJIT.enabled?) and RubyVM::YJIT.enabled?
330-
timeout = 1 # for --yjit-call-threshold=1
331-
end
332-
if defined?(RubyVM::MJIT.enabled?) and RubyVM::MJIT.enabled?
333-
timeout = 5 # for --jit-wait
334-
end
335342
Timeout.timeout(timeout) do
336343
CSV.parse(data, **options)
337344
fail("Parse didn't error out")

0 commit comments

Comments
 (0)