cat --ex now shows code for exceptions raised in the REPL

This commit is contained in:
John Mair 2011-09-11 04:41:05 +12:00
parent 90d88d3492
commit 7878654d42
3 changed files with 3 additions and 6 deletions

View File

@ -74,7 +74,6 @@ class Pry
if opts.ex?
next output.puts "No Exception or Exception has no associated file." if file_name.nil?
next output.puts "Cannot cat exceptions raised in REPL." if Pry.eval_path == file_name
else
file_name = args.shift
end

View File

@ -6,8 +6,8 @@ describe "Pry::DefaultCommands::Shell" do
# this doesnt work so well on rbx due to differences in backtrace
# so we currently skip rbx until we figure out a workaround
if !rbx?
it 'cat --ex should give warning when exception is raised in repl' do
mock_pry("this raises error", "cat --ex").should =~ /Cannot cat exceptions raised in REPL/
it 'cat --ex should correctly display code that generated exception even if raised in repl' do
mock_pry("this raises error", "cat --ex").should =~ /\d+:(\s*) this raises error/
end
it 'cat --ex should correctly display code that generated exception' do

View File

@ -19,7 +19,6 @@ describe Pry do
if RUBY_VERSION =~ /1.9/
describe "Exotic object support" do
# regression test for exotic object support
it "Should not error when return value is a BasicObject instance" do
@ -64,7 +63,7 @@ describe Pry do
o = Object.new
pry_tester = Pry.new(:input => StringIO.new(input_string),
:output => str_output,
:exception_handler => proc { |_, exception| @excep = exception },
:exception_handler => proc { |_, exception, _pry_| @excep = exception },
:print => proc {}
).rep(o)
@ -146,7 +145,6 @@ describe Pry do
str_output.string.should == ""
end
it 'should suppress output if input ends in a ";" (multi-line)' do
o = Object.new
str_output = StringIO.new