Skip to content

Commit eab51d1

Browse files
nirvdrumeregon
authored andcommitted
Add spec to ensure String#scrub works with lazy substrings.
1 parent 5231ede commit eab51d1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/ruby/core/string/scrub_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
"abc\u3042#{x81}".scrub.should == "abc\u3042\uFFFD"
1515
end
1616

17+
it "replaces invalid byte sequences in lazy substrings" do
18+
x81 = [0x81].pack('C').force_encoding('utf-8')
19+
"abc\u3042#{x81}def"[1...-1].scrub.should == "bc\u3042\uFFFDde"
20+
end
21+
1722
it "returns a copy of self when the input encoding is BINARY" do
1823
input = "foo".encode('BINARY')
1924

0 commit comments

Comments
 (0)