diff options
author | Kenichi Kamiya <kachick1@gmail.com> | 2012-10-20 21:36:23 +0900 |
---|---|---|
committer | Kenichi Kamiya <kachick1@gmail.com> | 2012-10-20 21:36:23 +0900 |
commit | 407348e48071e0e91fd999976d58c22577cc0554 (patch) | |
tree | 16ce44a98d7cc6268cae5de1f176768bfa33da28 /test | |
parent | 310422bba09a9a780a5f36a62784318366ad310b (diff) | |
download | slop-407348e48071e0e91fd999976d58c22577cc0554.tar.gz |
add test-suite for arity checker of Slop#respond_to?
Diffstat (limited to 'test')
-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 |