diff options
Diffstat (limited to 'spec/ruby/core/string/shared/each_line.rb')
-rw-r--r-- | spec/ruby/core/string/shared/each_line.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/string/shared/each_line.rb b/spec/ruby/core/string/shared/each_line.rb index 19cf5e6d78..066b0c1040 100644 --- a/spec/ruby/core/string/shared/each_line.rb +++ b/spec/ruby/core/string/shared/each_line.rb @@ -27,6 +27,19 @@ describe :string_each_line, shared: true do c.should == ["hello\n", "\n", "\n", "world"] end + it "splits strings containing multibyte characters" do + s = <<~EOS + foo + 🤡🤡🤡🤡🤡🤡🤡 + bar + baz + EOS + + b = [] + s.send(@method) { |part| b << part } + b.should == ["foo\n", "🤡🤡🤡🤡🤡🤡🤡\n", "bar\n", "baz\n"] + end + it "taints substrings that are passed to the block if self is tainted" do "one\ntwo\r\nthree".taint.send(@method) { |s| s.tainted?.should == true } |