summaryrefslogtreecommitdiff
path: root/test/test_delegate.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-03 23:15:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-03 23:15:55 +0000
commit10e8419da621fb4e6a9dd8346a6df8c707f962ba (patch)
tree035b25b7154f37e8e396e2502ec651877856284b /test/test_delegate.rb
parent7a4621eecff07d1d82c0f17442491198749223c3 (diff)
* lib/delegate.rb (Delegator): now inherits BasicObject.
[ruby-dev:39154], [Bug #2679], [ruby-dev:40242] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_delegate.rb')
-rw-r--r--test/test_delegate.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index bce1231..f57263b 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -34,12 +34,20 @@ class TestDelegateClass < Test::Unit::TestCase
def m
:o
end
+ private
+ def delegate_test_m
+ :o
+ end
end
class Foo
def m
:m
end
+ private
+ def delegate_test_m
+ :m
+ end
end
class Bar < DelegateClass(Foo)
@@ -50,6 +58,9 @@ class TestDelegateClass < Test::Unit::TestCase
assert_equal(:m, Foo.new.m)
assert_equal(:m, SimpleDelegator.new(Foo.new).m)
assert_equal(:m, Bar.new(Foo.new).m)
+ bug = '[ruby-dev:39154]'
+ assert_equal(:m, SimpleDelegator.new(Foo.new).__send__(:delegate_test_m), bug)
+ assert_equal(:m, Bar.new(Foo.new).__send__(:delegate_test_m), bug)
end
class IV < DelegateClass(Integer)
@@ -67,4 +78,11 @@ class TestDelegateClass < Test::Unit::TestCase
d = Marshal.load(Marshal.dump(c))
assert_equal(1, d.var, bug1744)
end
+
+ def test_copy_frozen
+ bug2679 = '[ruby-dev:40242]'
+ a = [42, :hello].freeze
+ d = SimpleDelegator.new(a)
+ assert_nothing_raised(bug2679) {d.dup[0] += 1}
+ end
end