diff options
Diffstat (limited to 'spec/ruby/library/stringscanner/shared/pos.rb')
| -rw-r--r-- | spec/ruby/library/stringscanner/shared/pos.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/ruby/library/stringscanner/shared/pos.rb b/spec/ruby/library/stringscanner/shared/pos.rb index 80ded17b0f..91f80fdf08 100644 --- a/spec/ruby/library/stringscanner/shared/pos.rb +++ b/spec/ruby/library/stringscanner/shared/pos.rb @@ -22,6 +22,13 @@ describe :strscan_pos, shared: true do @s.terminate @s.send(@method).should == @s.string.length end + + it "is not multi-byte character sensitive" do + s = StringScanner.new("abcädeföghi") + + s.scan_until(/ö/) + s.pos.should == 10 + end end describe :strscan_pos_set, shared: true do @@ -41,12 +48,12 @@ describe :strscan_pos_set, shared: true do end it "raises a RangeError if position too far backward" do - lambda { + -> { @s.send(@method, -20) - }.should raise_error(RangeError) + }.should.raise(RangeError) end it "raises a RangeError when the passed argument is out of range" do - lambda { @s.send(@method, 20) }.should raise_error(RangeError) + -> { @s.send(@method, 20) }.should.raise(RangeError) end end |
