summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_delegate.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index 18c175c719..48bf9cdbf0 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -3,6 +3,14 @@ require 'test/unit'
require 'delegate'
class TestDelegateClass < Test::Unit::TestCase
+ module PP
+ def mu_pp(obj)
+ str = super
+ str = "#<#{obj.class}: #{str}>" if Delegator === obj
+ str
+ end
+ end
+
module M
attr_reader :m
end
@@ -119,6 +127,18 @@ class TestDelegateClass < Test::Unit::TestCase
assert_equal([:bar], s.methods(false))
end
+ def test_eql?
+ extend PP
+ s0 = SimpleDelegator.new("foo")
+ s1 = SimpleDelegator.new("bar")
+ s2 = SimpleDelegator.new("foo")
+ assert_operator(s0, :eql?, s0)
+ assert_operator(s0, :eql?, "foo")
+ assert_operator(s0, :eql?, s2)
+ assert_not_operator(s0, :eql?, s1)
+ assert_not_operator(s0, :eql?, "bar")
+ end
+
class Foo
private
def delegate_test_private