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

Fix old_stack behavior on error

This commit is contained in:
Ryan Fitzgerald 2012-08-16 23:31:03 -07:00
parent 6271b16aee
commit 46e1196e75
2 changed files with 18 additions and 18 deletions

View file

@ -20,9 +20,9 @@ class Pry
BANNER BANNER
def process def process
stack, old_stack = context_from_object_path(arg_string, _pry_, state.old_stack||[]) state.old_stack ||= []
state.old_stack = old_stack stack, state.old_stack = context_from_object_path(arg_string, _pry_, state.old_stack)
_pry_.binding_stack = stack unless stack.nil? _pry_.binding_stack = stack if stack
end end
end end
end end

View file

@ -20,9 +20,9 @@ describe 'Pry::DefaultCommands::Cd' do
eval '_pry_.command_state["cd"]' eval '_pry_.command_state["cd"]'
end end
# def old_stack def old_stack
# eval '_pry_.command_state["cd"].old_stack.dup' eval '_pry_.command_state["cd"].old_stack.dup'
# end end
end end
end end
@ -42,20 +42,20 @@ describe 'Pry::DefaultCommands::Cd' do
end end
end end
# describe 'when an error was raised' do describe 'when an error was raised' do
# it 'should not toggle and should keep correct stacks' do it 'should not toggle and should keep correct stacks' do
# proc { proc {
# @t.eval 'cd @' @t.eval 'cd @'
# }.should.raise(Pry::CommandError) }.should.raise(Pry::CommandError)
# @t.old_stack.should == [] @t.old_stack.should == []
# @t.assert_binding_stack [@o] @t.assert_binding_stack [@o]
# @t.eval 'cd -' @t.eval 'cd -'
# @t.old_stack.should == [] @t.old_stack.should == []
# @t.assert_binding_stack [@o] @t.assert_binding_stack [@o]
# end end
# end end
describe 'when using simple cd syntax' do describe 'when using simple cd syntax' do
it 'should toggle' do it 'should toggle' do