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

Only a comma-at-the-end should make it an incomplete expression

This commit is contained in:
Conrad Irwin 2012-01-06 09:33:37 -08:00
parent 0d80cc53fa
commit 83480a099c
2 changed files with 12 additions and 1 deletions

View file

@ -566,7 +566,7 @@ class Pry
end
# Assert that a line which ends with a , or a \ is incomplete.
str !~ /[,\\]$/
str !~ /[,\\]\z/
rescue SyntaxError => e
if incomplete_user_input_exception?(e)
false

View file

@ -44,4 +44,15 @@ describe Pry do
end
output.string.should =~ /SyntaxError/
end
it "should allow trailing , to continue the line" do
pry = Pry.new
pry.complete_expression?("puts 1, 2,").should == false
end
it "should complete an expression that contains a line ending with a ," do
pry = Pry.new
pry.complete_expression?("puts 1, 2,\n3").should == true
end
end