summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb18
-rw-r--r--test/ruby/test_refinement.rb16
2 files changed, 26 insertions, 8 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index addce0d9ba..a19e22aab4 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -813,6 +813,15 @@ class TestArray < Test::Unit::TestCase
assert_nothing_raised(RuntimeError, bug10748) {a.flatten(1)}
end
+ def test_flattern_singleton_class
+ bug12738 = '[ruby-dev:49781] [Bug #12738]'
+ a = [[0]]
+ class << a
+ def m; end
+ end
+ assert_raise(NoMethodError, bug12738) { a.flatten.m }
+ end
+
def test_flatten!
a1 = @cls[ 1, 2, 3]
a2 = @cls[ 5, 6 ]
@@ -850,6 +859,15 @@ class TestArray < Test::Unit::TestCase
assert_nothing_raised(RuntimeError, bug10748) {a.flatten!(1)}
end
+ def test_flattern_singleton_class!
+ bug12738 = '[ruby-dev:49781] [Bug #12738]'
+ a = [[0]]
+ class << a
+ def m; end
+ end
+ assert_nothing_raised(NameError, bug12738) { a.flatten!.m }
+ end
+
def test_flatten_with_callcc
need_continuation
o = Object.new
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 5980280235..c3c2dbc61f 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1651,27 +1651,27 @@ class TestRefinement < Test::Unit::TestCase
module Foo
using RefB
- USED_REFS = Module.used_refinements
+ USED_MODS = Module.used_modules
end
module Bar
using RefC
- USED_REFS = Module.used_refinements
+ USED_MODS = Module.used_modules
end
module Combined
using RefA
using RefB
- USED_REFS = Module.used_refinements
+ USED_MODS = Module.used_modules
end
end
- def test_used_refinements
+ def test_used_modules
ref = VisibleRefinements
- assert_equal [], Module.used_refinements
- assert_equal [ref::RefB], ref::Foo::USED_REFS
- assert_equal [ref::RefC], ref::Bar::USED_REFS
- assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_REFS
+ assert_equal [], Module.used_modules
+ assert_equal [ref::RefB], ref::Foo::USED_MODS
+ assert_equal [ref::RefC], ref::Bar::USED_MODS
+ assert_equal [ref::RefB, ref::RefA], ref::Combined::USED_MODS
end
def test_warn_setconst_in_refinmenet