In Ruby 3.3, MJIT is replaced with RJIT.

https://github.com/ruby/csv/commit/cc6b47a4a7
This commit is contained in:
Nobuyoshi Nakada 2023-05-24 15:20:59 +09:00
Родитель 38ef537ce0
Коммит 31b28b31fa
1 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -323,15 +323,22 @@ line,5,jkl
end
private
def assert_parse_errors_out(data, **options)
{
"YJIT"=>1, # for --yjit-call-threshold=1
"MJIT"=>5, "RJIT"=>5, # for --jit-wait
}.any? do |jit, timeout|
if (RubyVM.const_defined?(jit) and
jit = RubyVM.const_get(jit) and
jit.respond_to?(:enabled?) and
jit.enabled?)
PARSE_ERROR_TIMEOUT = timeout
end
end
PARSE_ERROR_TIMEOUT ||= 0.2
def assert_parse_errors_out(data, timeout: PARSE_ERROR_TIMEOUT, **options)
assert_raise(CSV::MalformedCSVError) do
timeout = 0.2
if defined?(RubyVM::YJIT.enabled?) and RubyVM::YJIT.enabled?
timeout = 1 # for --yjit-call-threshold=1
end
if defined?(RubyVM::RJIT.enabled?) and RubyVM::RJIT.enabled?
timeout = 5 # for --jit-wait
end
Timeout.timeout(timeout) do
CSV.parse(data, **options)
fail("Parse didn't error out")