Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/method_source/code_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def complete_expression?(str)
eval("BEGIN{throw :valid}\n#{str}")
end

# Assert that a line which ends with a , or \ is incomplete.
str !~ /[,\\]\s*\z/
# Assert that a line which ends with a , or \ but not with $\ is incomplete.
str !~ /(?:,|[^\$]\\)\s*\z/
rescue IncompleteExpression
false
ensure
Expand Down
4 changes: 4 additions & 0 deletions test/test_code_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@
}.should.raise(SyntaxError)
end
end

it "should consider as complete lines ending with $\\" do
@tester.complete_expression?('$\\').should == true
end
end