Sha256: 97a42f89daf3acf58cf3e90295a173d4bbcba3fd2b3a1791bc31a9fd8621ceae

Contents?: true

Size: 375 Bytes

Versions: 3

Compression:

Stored size: 375 Bytes

Contents

require 'strscan'

describe "StringScanner#check" do
  before :each do
    @s = StringScanner.new("This is a test")
  end

  it "returns the value that scan would return, without advancing the scan pointer" do
    @s.check(/This/).should == "This"
    @s.matched.should == "This"
    @s.pos.should == 0
    @s.check(/is/).should == nil
    @s.matched.should == nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-strscan-1.0.1 spec/check_spec.rb
rubysl-strscan-1.0.0 spec/check_spec.rb
rubysl-strscan-2.0.0 spec/check_spec.rb