summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringscanner/shared/pos.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringscanner/shared/pos.rb')
-rw-r--r--spec/ruby/library/stringscanner/shared/pos.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/ruby/library/stringscanner/shared/pos.rb b/spec/ruby/library/stringscanner/shared/pos.rb
index 6d540881f2..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
@@ -43,10 +50,10 @@ describe :strscan_pos_set, shared: true do
it "raises a RangeError if position too far backward" do
-> {
@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
- -> { @s.send(@method, 20) }.should raise_error(RangeError)
+ -> { @s.send(@method, 20) }.should.raise(RangeError)
end
end