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

cd '../' no longer breaks out of the REPL loop. Closes #403.

Conflicts:

	test/test_default_commands/test_context.rb
This commit is contained in:
Rob Gleeson 2012-01-04 04:45:24 +00:00
parent 1baf8131a0
commit d1544d9b8d
2 changed files with 10 additions and 6 deletions

View file

@ -24,10 +24,7 @@ class Pry
when "."
next
when ".."
if stack.one?
_pry_.binding_stack.clear
throw(:breakout)
else
unless stack.size == 1
stack.pop
end
else

View file

@ -141,8 +141,15 @@ describe "Pry::DefaultCommands::Context" do
$outer.should == :outer
end
it 'should break out of the repl loop of Pry instance when binding_stack has only one binding with cd ..' do
Pry.start(0, :input => StringIO.new("cd ..")).should == nil
it "should not leave the REPL session when given 'cd ..'" do
b = Pry.binding_for(Object.new)
input = InputTester.new "cd ..", "$obj = self", "exit-all"
redirect_pry_io(input, StringIO.new) do
b.pry
end
$obj.should == b.eval("self")
end
it 'should break out to outer-most session with cd /' do