1 require File.dirname(__FILE__) + '/../../spec_helper'
4 describe "StringScanner#scan_full" do
6 @s = StringScanner.new("This is a test")
9 it "returns the number of bytes advanced" do
11 @s.scan_full(/This/, false, false).should == 4
12 @s.pos.should == orig_pos
15 it "returns the number of bytes advanced and advances the scan pointer if the second argument is true" do
16 @s.scan_full(/This/, true, false).should == 4
20 it "returns the matched string if the third argument is true" do
22 @s.scan_full(/This/, false, true).should == "This"
23 @s.pos.should == orig_pos
26 it "returns the matched string if the third argument is true and advances the scan pointer if the second argument is true" do
27 @s.scan_full(/This/, true, true).should == "This"