mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Don't clobber _ex_ on typoes
This commit is contained in:
parent
d2f5725537
commit
c74d240d0a
2 changed files with 11 additions and 1 deletions
|
@ -257,7 +257,12 @@ class Pry
|
|||
output.puts "Error: #{e.message}"
|
||||
end
|
||||
|
||||
begin
|
||||
break if complete_expression?(eval_string)
|
||||
rescue SyntaxError => e
|
||||
output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
|
||||
eval_string = ""
|
||||
end
|
||||
end
|
||||
|
||||
@suppress_output = true if eval_string =~ /;\Z/ || eval_string.empty?
|
||||
|
|
|
@ -55,4 +55,9 @@ describe Pry do
|
|||
pry = Pry.new
|
||||
pry.complete_expression?("puts 1, 2,\n3").should == true
|
||||
end
|
||||
|
||||
it "should not clobber _ex_ on a SyntaxError in the repl" do
|
||||
|
||||
mock_pry("raise RuntimeError, 'foo';", "puts foo)", "_ex_.is_a?(RuntimeError)").should =~ /^RuntimeError.*\nSyntaxError.*\n=> true/m
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue