Skip to content

Commit 5c69a4d

Browse files
herwinwandrykonchin
authored andcommitted
Add spec for StringScanner#pos with multi-byte character
This is where this method differentiates from charpos.
1 parent 06c6f7d commit 5c69a4d

File tree

1 file changed

+7
-0
lines changed
  • library/stringscanner/shared

1 file changed

+7
-0
lines changed

library/stringscanner/shared/pos.rb

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
@s.terminate
2323
@s.send(@method).should == @s.string.length
2424
end
25+
26+
it "is not multi-byte character sensitive" do
27+
s = StringScanner.new("abcädeföghi")
28+
29+
s.scan_until(/ö/)
30+
s.pos.should == 10
31+
end
2532
end
2633

2734
describe :strscan_pos_set, shared: true do

0 commit comments

Comments
 (0)