ruby-changes:69117
From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:53 +0900 (JST)
Subject: [ruby-changes:69117] 3a3f706698 (master): Additional invokesuper tests
https://git.ruby-lang.org/ruby.git/commit/?id=3a3f706698 From 3a3f7066986b6d0a24a6f7c72d2304381269b30d Mon Sep 17 00:00:00 2001 From: John Hawthorn <john@h...> Date: Mon, 30 Aug 2021 20:57:31 -0700 Subject: Additional invokesuper tests --- bootstraptest/test_yjit.rb | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) 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{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_yjit.rb#L1444 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) -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/