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:
parent
0d80cc53fa
commit
83480a099c
2 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue