1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

show-source for non-extant methods should return error msg. Fix #697

This commit is contained in:
Reginald Tan 2012-08-23 08:09:44 -04:00
parent bc2a79605d
commit 2edb9ae89a
2 changed files with 6 additions and 1 deletions

View file

@ -31,7 +31,7 @@ class Pry
:method
elsif Pry::WrappedModule.from_str(input, target)
:module
elsif target.eval("defined? #{input} ") =~ /variable|constant/
elsif target.eval("defined?(#{input})") =~ /variable|constant/
:variable_or_constant
elsif find_command(input)
:command

View file

@ -89,6 +89,11 @@ if !mri18_and_no_real_source_location?
mock_pry(binding, "show-source c.new.method").should =~ /98/
end
it "should not show the source when a non-extant method is requested" do
c = Class.new{ def method; 98; end }
mock_pry(binding, "show-source c#wrongmethod").should =~ /could not be found/
end
it "should find instance_methods even if the class has an override instance_method method" do
c = Class.new{
def method;