Updated RubySpec source to 55122684.
[rbx.git] / spec / frozen / 1.8 / library / stringscanner / search_full_spec.rb
blobf73d1e8da9e89b6ca3a0938f5cf9e7ee1302bfa3
1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require 'strscan'
4 describe "StringScanner#search_full" do
5   before :each do
6     @s = StringScanner.new("This is a test")
7   end
9   it "returns the number of bytes advanced" do
10     orig_pos = @s.pos
11     @s.search_full(/This/, false, false).should == 4
12     @s.pos.should == orig_pos
13   end
15   it "returns the number of bytes advanced and advances the scan pointer if the second argument is true" do
16     @s.search_full(/This/, true, false).should == 4
17     @s.pos.should == 4
18   end
20   it "returns the matched string if the third argument is true" do
21     orig_pos = @s.pos
22     @s.search_full(/This/, false, true).should == "This"
23     @s.pos.should == orig_pos
24   end
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.search_full(/This/, true, true).should == "This"
28     @s.pos.should == 4
29   end
30 end