blob: a5e971631a5303de36de917572ac76ccfbfd5455 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
require_relative '../../spec_helper'
require 'strscan'
describe "StringScanner#rest_size" do
before :each do
@s = StringScanner.new('This is a test')
end
it "returns the length of the rest of the string" do
@s.rest_size.should == 14
@s.scan(/This/)
@s.rest_size.should == 10
@s.terminate
@s.rest_size.should == 0
end
it "is equivalent to rest.size" do
@s.scan(/This/)
@s.rest_size.should == @s.rest.size
end
end
|