@@ -115,7 +115,7 @@ def syntax_check(code, fname, line)
115115
116116 def assert_no_memory_leak ( args , prepare , code , message = nil , limit : 2.0 , rss : false , **opt )
117117 # TODO: consider choosing some appropriate limit for MJIT and stop skipping this once it does not randomly fail
118- pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined? ( RubyVM ::MJIT ) && RubyVM ::MJIT . enabled?
118+ pend 'assert_no_memory_leak may consider MJIT memory usage as leak' if defined? ( RubyVM ::JIT ) && RubyVM ::JIT . enabled?
119119
120120 require_relative '../../memory_status'
121121 raise MiniTest ::Skip , "unsupported platform" unless defined? ( Memory ::Status )
@@ -264,7 +264,7 @@ def separated_runner(out = nil)
264264 at_exit {
265265 out . puts [ Marshal . dump ( $!) ] . pack ( 'm' ) , "assertions=\# {self._assertions}"
266266 }
267- Test ::Unit ::Runner . class_variable_set ( :@@stop_auto_run , true )
267+ Test ::Unit ::Runner . class_variable_set ( :@@stop_auto_run , true ) if defined? ( Test :: Unit :: Runner )
268268 end
269269
270270 def assert_separately ( args , file = nil , line = nil , src , ignore_stderr : nil , **opt )
@@ -276,7 +276,7 @@ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **o
276276 capture_stdout = true
277277 unless /mswin|mingw/ =~ RUBY_PLATFORM
278278 capture_stdout = false
279- opt [ :out ] = MiniTest ::Unit . output
279+ opt [ :out ] = MiniTest ::Unit . output if defined? ( MiniTest :: Unit )
280280 res_p , res_c = IO . pipe
281281 opt [ res_c . fileno ] = res_c . fileno
282282 end
@@ -330,6 +330,27 @@ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **o
330330 raise marshal_error if marshal_error
331331 end
332332
333+ # Run Ractor-related test without influencing the main test suite
334+ def assert_ractor ( src , args : [ ] , require : nil , require_relative : nil , file : nil , line : nil , ignore_stderr : nil , **opt )
335+ return unless defined? ( Ractor )
336+
337+ require = "require #{ require . inspect } " if require
338+ if require_relative
339+ dir = File . dirname ( caller_locations [ 0 , 1 ] [ 0 ] . absolute_path )
340+ full_path = File . expand_path ( require_relative , dir )
341+ require = "#{ require } ; require #{ full_path . inspect } "
342+ end
343+
344+ assert_separately ( args , file , line , <<~RUBY , ignore_stderr : ignore_stderr , **opt )
345+ #{ require }
346+ previous_verbose = $VERBOSE
347+ $VERBOSE = nil
348+ Ractor.new {} # trigger initial warning
349+ $VERBOSE = previous_verbose
350+ #{ src }
351+ RUBY
352+ end
353+
333354 # :call-seq:
334355 # assert_throw( tag, failure_message = nil, &block )
335356 #
@@ -587,6 +608,20 @@ def assert_warn(*args)
587608 assert_warning ( *args ) { $VERBOSE = false ; yield }
588609 end
589610
611+ def assert_deprecated_warning ( mesg = /deprecated/ )
612+ assert_warning ( mesg ) do
613+ Warning [ :deprecated ] = true
614+ yield
615+ end
616+ end
617+
618+ def assert_deprecated_warn ( mesg = /deprecated/ )
619+ assert_warn ( mesg ) do
620+ Warning [ :deprecated ] = true
621+ yield
622+ end
623+ end
624+
590625 class << ( AssertFile = Struct . new ( :failure_message ) . new )
591626 include CoreAssertions
592627 def assert_file_predicate ( predicate , *args )
0 commit comments