Sha256: e92d6aab670a496b47c94b54a69bad5890c6b3d3881281d63cffe9db1f1782f2

Contents?: true

Size: 981 Bytes

Versions: 77

Compression:

Stored size: 981 Bytes

Contents

require 'helper'

describe "exit" do
  it 'should pop a binding with exit' do
    pry_tester(:outer).simulate_repl do |t|
      t.eval 'cd :inner'
      t.eval('self').should == :inner
      t.eval 'exit'
      t.eval('self').should == :outer
      t.eval 'exit-all'
    end
  end

  it 'should break out of the repl loop of Pry instance when binding_stack has only one binding with exit' do
    pry_tester(0).simulate_repl do |t|
      t.eval 'exit'
    end.should == nil
  end

  it 'should break out of the repl loop of Pry instance when binding_stack has only one binding with exit, and return user-given value' do
    pry_tester(0).simulate_repl do |t|
      t.eval 'exit :john'
    end.should == :john
  end

  it 'should break out the repl loop of Pry instance even after an exception in user-given value' do
    pry_tester(0).simulate_repl do |t|
      proc {
        t.eval 'exit = 42'
      }.should.raise(SyntaxError)
      t.eval 'exit'
    end.should == nil
  end
end

Version data entries

77 entries across 77 versions & 5 rubygems

Version Path
pry-0.9.11.4-java spec/commands/exit_spec.rb
pry-0.9.11.3 spec/commands/exit_spec.rb
pry-0.9.11.3-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.11.3-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.11.3-java spec/commands/exit_spec.rb
pry-0.9.11.2 spec/commands/exit_spec.rb
pry-0.9.11.2-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.11.2-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.11.2-java spec/commands/exit_spec.rb
pry-0.9.11.1 spec/commands/exit_spec.rb
pry-0.9.11.1-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.11.1-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.11.1-java spec/commands/exit_spec.rb
pry-0.9.11 spec/commands/exit_spec.rb
pry-0.9.11-i386-mswin32 spec/commands/exit_spec.rb
pry-0.9.11-i386-mingw32 spec/commands/exit_spec.rb
pry-0.9.11-java spec/commands/exit_spec.rb