-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds SyntaxError and warning spec for not same line heredoc #794
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,22 @@ | |
s.encoding.should == Encoding::US_ASCII | ||
end | ||
|
||
ruby_version_is "2.7" do | ||
it 'raises SyntaxError if identifier is ending not on same line' do | ||
-> { | ||
eval %{<<"HERE\n"\nHERE} | ||
}.should raise_error(SyntaxError) | ||
end | ||
end | ||
|
||
ruby_version_is ""..."2.7" do | ||
it 'prints a warning if identifier is ending not on same line' do | ||
-> { | ||
eval %{<<"HERE\n"\nHERE} | ||
}.should complain(/here document identifier ends with a newline/) | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wording issue. It's common to write just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean add the message in heredoc string itself? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No-no. I meant the wording in the spec description - |
||
|
||
it "allows HEREDOC with <<~'identifier', allowing to indent identifier and content" do | ||
require_relative 'fixtures/squiggly_heredoc' | ||
SquigglyHeredocSpecs.message.should == "character density, n.:\n The number of very weird people in the office.\n" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's missing "quoted identifier"