diff options
-rw-r--r-- | test/slop_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb index d258543..8b9706a 100644 --- a/test/slop_test.rb +++ b/test/slop_test.rb @@ -414,4 +414,22 @@ class SlopTest < TestCase assert_equal true, opts['no-bar'] end + test "respond_to?() arity checker is similar of other objects" do + slop = Slop.new + obj = Object.new + + assert_same obj.respond_to?(:__id__), slop.respond_to?(:__id__) + assert_same obj.respond_to?(:__id__, false), slop.respond_to?(:__id__, false) + assert_same obj.respond_to?(:__id__, true), slop.respond_to?(:__id__, true) + + exeption = begin + obj.respond_to? :__id__, false, :INVALID_ARGUMENT + rescue Exception + $! + end + assert_raises exeption.class do + slop.respond_to? :__id__, false, :INVALID_ARGUMENT + end + end + end |