Skip to content

Commit 8d04a12

Browse files
committed
Spec for String#lines with multibyte characters
1 parent 5975d2a commit 8d04a12

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

spec/ruby/core/string/shared/each_line.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
c.should == ["hello\n", "\n", "\n", "world"]
2828
end
2929

30+
it "splits strings containing multibyte characters" do
31+
s = <<~EOS
32+
foo
33+
🤡🤡🤡🤡🤡🤡🤡
34+
bar
35+
baz
36+
EOS
37+
38+
b = []
39+
s.send(@method) { |s| b << s }
40+
b.should == ["foo\n", "🤡🤡🤡🤡🤡🤡🤡\n", "bar\n", "baz\n"]
41+
end
42+
3043
it "taints substrings that are passed to the block if self is tainted" do
3144
"one\ntwo\r\nthree".taint.send(@method) { |s| s.tainted?.should == true }
3245

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fails:String#each_line splits strings containing multibyte characters

spec/tags/core/string/lines_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fails:String#lines splits strings containing multibyte characters

0 commit comments

Comments
 (0)