diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-01 11:20:30 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-01 11:20:30 +0900 |
| commit | b80e0ef7428b613a682da4d2a251c8beb24d6dd2 (patch) | |
| tree | d47427ac2f9bb454f9a47b79d6767ee27bd0c8f0 /test/t | |
| parent | 593c12a5cd670cfdb45741377236207a56541d37 (diff) | |
| download | mruby-b80e0ef7428b613a682da4d2a251c8beb24d6dd2.tar.gz mruby-b80e0ef7428b613a682da4d2a251c8beb24d6dd2.zip | |
Move `Kernel#send` to `mruby-metaprog` gem.
But `BasicObject#__send__` is still available from the core.
Diffstat (limited to 'test/t')
| -rw-r--r-- | test/t/codegen.rb | 4 | ||||
| -rw-r--r-- | test/t/kernel.rb | 28 | ||||
| -rw-r--r-- | test/t/module.rb | 106 |
3 files changed, 55 insertions, 83 deletions
diff --git a/test/t/codegen.rb b/test/t/codegen.rb index 154d44168..acb9e1bf5 100644 --- a/test/t/codegen.rb +++ b/test/t/codegen.rb @@ -184,14 +184,14 @@ assert('register window of calls (#3783)') do # NODE_UNDEF assert_nothing_raised do class << Object.new - undef send + undef inspect end end # NODE_ALIAS assert_nothing_raised do class << Object.new - alias send2 send + alias inspect2 inspect end end end diff --git a/test/t/kernel.rb b/test/t/kernel.rb index 9744bddba..a730bdb24 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -92,20 +92,6 @@ assert('Kernel#__id__', '15.3.1.3.3') do assert_equal Fixnum, __id__.class end -assert('Kernel#__send__', '15.3.1.3.4') do - # test with block - l = __send__(:lambda) do - true - end - - assert_true l.call - assert_equal Proc, l.class - # test with argument - assert_true __send__(:respond_to?, :nil?) - # test without argument and without block - assert_equal String, __send__(:to_s).class -end - assert('Kernel#block_given?', '15.3.1.3.6') do def bg_try(&b) if block_given? @@ -440,20 +426,6 @@ assert('Kernel#respond_to?', '15.3.1.3.43') do assert_false Test4RespondTo.new.respond_to?(:test_method) end -assert('Kernel#send', '15.3.1.3.44') do - # test with block - l = send(:lambda) do - true - end - - assert_true l.call - assert_equal l.class, Proc - # test with argument - assert_true send(:respond_to?, :nil?) - # test without argument and without block - assert_equal send(:to_s).class, String -end - assert('Kernel#to_s', '15.3.1.3.46') do assert_equal to_s.class, String end diff --git a/test/t/module.rb b/test/t/module.rb index fda375721..78cb5d07f 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -536,61 +536,61 @@ end #end # mruby has no visibility control - assert 'Module#prepend visibility' do - bug8005 = '[ruby-core:53106] [Bug #8005]' - c = Class.new do - prepend Module.new {} - def foo() end - protected :foo - end - a = c.new - assert_true a.respond_to?(:foo), bug8005 - assert_nothing_raised(bug8005) {a.send :foo} - end + # assert 'Module#prepend visibility' do + # bug8005 = '[ruby-core:53106] [Bug #8005]' + # c = Class.new do + # prepend Module.new {} + # def foo() end + # protected :foo + # end + # a = c.new + # assert_true a.respond_to?(:foo), bug8005 + # assert_nothing_raised(bug8005) {a.send :foo} + # end # mruby has no visibility control - assert 'Module#prepend inherited visibility' do - bug8238 = '[ruby-core:54105] [Bug #8238]' - module Test4PrependVisibilityInherited - class A - def foo() A; end - private :foo - end - class B < A - public :foo - prepend Module.new - end - end - assert_equal(Test4PrependVisibilityInherited::A, Test4PrependVisibilityInherited::B.new.foo, "#{bug8238}") - end - - assert 'Module#prepend super in alias' do - skip "super does not currently work in aliased methods" - bug7842 = '[Bug #7842]' - - p = labeled_module("P") do - def m; "P"+super; end - end - - a = labeled_class("A") do - def m; "A"; end - end - - b = labeled_class("B", a) do - def m; "B"+super; end - alias m2 m - prepend p - alias m3 m - end - - assert_nothing_raised do - assert_equal("BA", b.new.m2, bug7842) - end - - assert_nothing_raised do - assert_equal("PBA", b.new.m3, bug7842) - end - end + # assert 'Module#prepend inherited visibility' do + # bug8238 = '[ruby-core:54105] [Bug #8238]' + # module Test4PrependVisibilityInherited + # class A + # def foo() A; end + # private :foo + # end + # class B < A + # public :foo + # prepend Module.new + # end + # end + # assert_equal(Test4PrependVisibilityInherited::A, Test4PrependVisibilityInherited::B.new.foo, "#{bug8238}") + # end + + # assert 'Module#prepend super in alias' do + # skip "super does not currently work in aliased methods" + # bug7842 = '[Bug #7842]' + + # p = labeled_module("P") do + # def m; "P"+super; end + # end + + # a = labeled_class("A") do + # def m; "A"; end + # end + + # b = labeled_class("B", a) do + # def m; "B"+super; end + # alias m2 m + # prepend p + # alias m3 m + # end + + # assert_nothing_raised do + # assert_equal("BA", b.new.m2, bug7842) + # end + + # assert_nothing_raised do + # assert_equal("PBA", b.new.m3, bug7842) + # end + # end assert 'Module#prepend each class' do m = labeled_module("M") |
