@@ -1153,7 +1153,7 @@ def foo
1153
1153
end
1154
1154
1155
1155
def test_invalidate_cyclic_branch
1156
- assert_compiles ( <<~'RUBY' , result : 2 )
1156
+ assert_compiles ( <<~'RUBY' , result : 2 , exits : { opt_plus : 1 } )
1157
1157
def foo
1158
1158
i = 0
1159
1159
while i < 2
@@ -1171,7 +1171,7 @@ def +(x) = self - -x
1171
1171
end
1172
1172
1173
1173
def test_tracing_str_uplus
1174
- assert_compiles ( <<~RUBY , frozen_string_literal : true , result : :ok )
1174
+ assert_compiles ( <<~RUBY , frozen_string_literal : true , result : :ok , exits : { putspecialobject : 1 , definemethod : 1 } )
1175
1175
def str_uplus
1176
1176
_ = 1
1177
1177
_ = 2
@@ -1216,7 +1216,7 @@ def test(str)
1216
1216
1217
1217
def test_return_to_invalidated_block
1218
1218
# [Bug #19463]
1219
- assert_compiles ( <<~RUBY , result : [ 1 , 1 , :ugokanai ] )
1219
+ assert_compiles ( <<~RUBY , result : [ 1 , 1 , :ugokanai ] , exits : { definesmethod : 1 , getlocal_WC_0 : 1 } )
1220
1220
klass = Class.new do
1221
1221
def self.lookup(hash, key) = hash[key]
1222
1222
@@ -1257,7 +1257,7 @@ def freeze = :ugokanai
1257
1257
1258
1258
def test_setivar_on_class
1259
1259
# Bug in https://github.com/ruby/ruby/pull/8152
1260
- assert_compiles ( <<~RUBY , result : :ok )
1260
+ assert_compiles ( <<~RUBY , result : :ok , exits : { opt_getconstant_path : 2 } )
1261
1261
class Base
1262
1262
def self.or_equal
1263
1263
@or_equal ||= Object.new
@@ -1280,7 +1280,7 @@ class Child < Base
1280
1280
1281
1281
def test_nested_send
1282
1282
#[Bug #19464]
1283
- assert_compiles ( <<~RUBY , result : [ :ok , :ok ] )
1283
+ assert_compiles ( <<~RUBY , result : [ :ok , :ok ] , exits : { opt_getconstant_path : 1 , defineclass : 1 } )
1284
1284
klass = Class.new do
1285
1285
class << self
1286
1286
alias_method :my_send, :send
@@ -1318,7 +1318,7 @@ def foo(a, b, h)
1318
1318
end
1319
1319
1320
1320
def test_io_reopen_clobbering_singleton_class
1321
- assert_compiles ( <<~RUBY , result : [ :ok , :ok ] )
1321
+ assert_compiles ( <<~RUBY , result : [ :ok , :ok ] , exits : { definesmethod : 1 , opt_eq : 2 } )
1322
1322
def $stderr.to_i = :i
1323
1323
1324
1324
def test = $stderr.to_i
@@ -1434,7 +1434,7 @@ def collect_insns(iseq)
1434
1434
# barriers, cache misses.)
1435
1435
if exits != :any &&
1436
1436
exits != recorded_exits &&
1437
- ! exits . all? { |k , v | v === recorded_exits [ k ] } # triple-equal checks range membership or integer equality
1437
+ ( exits . keys != recorded_exits . keys || ! exits . all? { |k , v | v === recorded_exits [ k ] } ) # triple-equal checks range membership or integer equality
1438
1438
flunk "Expected #{ exits . empty? ? "no" : exits . inspect } exits" \
1439
1439
", but got\n #{ recorded_exits . inspect } "
1440
1440
end
0 commit comments