1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add assert_ractor [Feature #17367]

This commit is contained in:
Marc-Andre Lafortune 2020-12-19 12:54:07 -05:00 committed by Marc-André Lafortune
parent 7f8108eeff
commit 70f20234b2
Notes: git 2020-12-20 07:13:35 +09:00

View file

@ -330,6 +330,23 @@ eom
raise marshal_error if marshal_error
end
# Run Ractor-related test without influencing the main test suite
def assert_ractor(src, args: [], file: nil, line: nil, ignore_stderr: nil, **opt)
return unless defined?(Ractor)
if (req = opt.delete(:require))
req = "require #{req.inspect}"
end
assert_separately(args, file, line, <<~RUBY, ignore_stderr: ignore_stderr, **opt)
#{req}
previous_verbose = $VERBOSE
$VERBOSE = nil
Ractor.new {} # trigger initial warning
$VERBOSE = previous_verbose
#{src}
RUBY
end
# :call-seq:
# assert_throw( tag, failure_message = nil, &block )
#