1 require File.dirname(__FILE__) + '/../../spec_helper'
4 describe "StringScanner#match?" do
6 @s = StringScanner.new("This is a test")
9 it "returns the length of the match and the scan pointer is not advanced" do
10 @s.match?(/\w+/).should == 4
11 @s.match?(/\w+/).should == 4
15 it "returns nil if there's no match" do
16 @s.match?(/\d+/).should == nil
17 @s.match?(/\s+/).should == nil