summaryrefslogtreecommitdiff
path: root/spec/ruby/language/heredoc_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/heredoc_spec.rb')
-rw-r--r--spec/ruby/language/heredoc_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/language/heredoc_spec.rb b/spec/ruby/language/heredoc_spec.rb
index 1ec21a2ec0..95df8457e4 100644
--- a/spec/ruby/language/heredoc_spec.rb
+++ b/spec/ruby/language/heredoc_spec.rb
@@ -59,6 +59,22 @@ HERE
s.encoding.should == Encoding::US_ASCII
end
+ ruby_version_is "2.7" do
+ it 'raises SyntaxError if quoted HEREDOC identifier is ending not on same line' do
+ -> {
+ eval %{<<"HERE\n"\nraises syntax error\nHERE}
+ }.should raise_error(SyntaxError)
+ end
+ end
+
+ ruby_version_is ""..."2.7" do
+ it 'prints a warning if quoted HEREDOC identifier is ending not on same line' do
+ -> {
+ eval %{<<"HERE\n"\nit warns\nHERE}
+ }.should complain(/here document identifier ends with a newline/)
+ end
+ end
+
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"