Skip to content

Commit

Permalink
Merge pull request #1236 from carsonmcdonald/moreresptotests
Browse files Browse the repository at this point in the history
Adding a few more respond_to tests
  • Loading branch information
matz committed May 6, 2013
2 parents 5e40c9b + 61c0b8f commit f568b49
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/t/kernel.rb
Expand Up @@ -354,12 +354,26 @@ def test_method; end
# Kernel#require is defined in mruby-require. '15.3.1.3.42'

assert('Kernel#respond_to?', '15.3.1.3.43') do
e_list = []

class Test4RespondTo
def valid_method; end

def test_method; end
undef test_method
end

respond_to?(:nil?) and Test4RespondTo.new.respond_to?(:test_method) == false
begin
Test4RespondTo.new.respond_to?(1)
rescue => e
e_list << e.class
end

e_list[0] == TypeError and
respond_to?(:nil?) and
Test4RespondTo.new.respond_to?(:valid_method) == true and
Test4RespondTo.new.respond_to?('valid_method') == true and
Test4RespondTo.new.respond_to?(:test_method) == false
end

assert('Kernel#send', '15.3.1.3.44') do
Expand Down

0 comments on commit f568b49

Please sign in to comment.