mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Don't try to autoload constants
This commit is contained in:
parent
65e6e6a788
commit
19e83828cf
2 changed files with 6 additions and 1 deletions
|
@ -84,7 +84,7 @@ class Pry
|
|||
|
||||
def format_constants(mod, constants)
|
||||
constants.sort_by(&:downcase).map do |name|
|
||||
if const = (mod.const_get(name) rescue nil)
|
||||
if const = (!mod.autoload?(name) && mod.const_get(name) rescue nil)
|
||||
if (const < Exception rescue false)
|
||||
color(:exception_constant, name)
|
||||
elsif (Module === mod.const_get(name) rescue false)
|
||||
|
|
|
@ -87,6 +87,11 @@ describe "ls" do
|
|||
it "should show constants defined on ancestors with -v" do
|
||||
mock_pry("class TempFoo4; LHGRAB = 1; end; class TempFoo5 < TempFoo4; BARGHL = 1; end", "ls -v TempFoo5").should =~ /LHGRAB/
|
||||
end
|
||||
|
||||
it "should not autoload constants!" do
|
||||
autoload :McflurgleTheThird, "/tmp/this-file-d000esnat-exist.rb"
|
||||
lambda{ mock_pry("ls -c") }.should.not.raise
|
||||
end
|
||||
end
|
||||
|
||||
describe "grep" do
|
||||
|
|
Loading…
Reference in a new issue