Skip to content

Commit 57c69fc

Browse files
Sergio Garciaeregon
authored andcommitted
tests squiggly heredoc
* See #175 * See [Feature 9098]
1 parent ce4eb8f commit 57c69fc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

language/fixtures/squiggly_heredoc.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module StringSpecs
2+
def self.squiggly_message
3+
<<~HEREDOC
4+
character density, n.:
5+
The number of very weird people in the office.
6+
HEREDOC
7+
end
8+
end

language/string_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
require File.expand_path('../../spec_helper', __FILE__)
44

5+
ruby_version_is "2.3" do
6+
require File.expand_path('../fixtures/squiggly_heredoc', __FILE__)
7+
end
8+
59
# TODO: rewrite these horrid specs. it "are..." seriously?!
610

711
describe "Ruby character strings" do
@@ -176,6 +180,12 @@
176180
s.should == ' foo bar#{@ip}' + "\n"
177181
end
178182

183+
ruby_version_is "2.3" do
184+
it "allows HEREDOC with <<~'identifier', allowing to indent identifier and content" do
185+
StringSpecs.squiggly_message.should == "character density, n.:\n The number of very weird people in the office.\n"
186+
end
187+
end
188+
179189
it "calls #to_s when the object is not a String" do
180190
obj = mock('to_s')
181191
obj.stub!(:to_s).and_return('42')

0 commit comments

Comments
 (0)