Sha256: c0086e2b0aa09aab15fb33ee23c0f542bc6e1fcf2eb50351730098204c1d6ea6

Contents?: true

Size: 350 Bytes

Versions: 3

Compression:

Stored size: 350 Bytes

Contents

require 'strscan'

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

  it "returns length of the match" do
    @s.skip(/\w+/).should == 4
    @s.skip(/\s+\w+/).should == 3
  end

  it "returns nil if there's no match" do
    @s.skip(/\s+/).should == nil
    @s.skip(/\d+/).should == nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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