diff options
author | John Hawthorn <john@hawthorn.email> | 2021-08-30 20:57:31 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:39 -0400 |
commit | 3a3f7066986b6d0a24a6f7c72d2304381269b30d (patch) | |
tree | 094c2bee5b2a2a2a5b944fc9ee21980b1a9a802a /bootstraptest | |
parent | 3ecc6befcdfb14c6bfd345bd6bebd2e84dc32c27 (diff) |
Additional invokesuper tests
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index d91daea8ac..96141e315c 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -1444,6 +1444,85 @@ assert_equal '[:B, [:B, :m]]', %q{ ins.bar } +# invokesuper changed ancestor +assert_equal '[:A, [:M, :B]]', %q{ + class B + def foo + :B + end + end + + class A < B + def foo + [:A, super] + end + end + + module M + def foo + [:M, super] + end + end + + ins = A.new + ins.foo + ins.foo + A.include(M) + ins.foo +} + +# invokesuper changed ancestor via prepend +assert_equal '[:A, [:M, :B]]', %q{ + class B + def foo + :B + end + end + + class A < B + def foo + [:A, super] + end + end + + module M + def foo + [:M, super] + end + end + + ins = A.new + ins.foo + ins.foo + B.prepend(M) + ins.foo +} + +# invokesuper replaced method +assert_equal '[:A, :Btwo]', %q{ + class B + def foo + :B + end + end + + class A < B + def foo + [:A, super] + end + end + + ins = A.new + ins.foo + ins.foo + class B + def foo + :Btwo + end + end + ins.foo +} + # Call to fixnum assert_equal '[true, false]', %q{ def is_odd(obj) |