Sha256: e4d9093ba14c8d5725f715e378bdc3f64325ff722e617ddfa8eabcb902072e31

Contents?: true

Size: 429 Bytes

Versions: 3

Compression:

Stored size: 429 Bytes

Contents

require 'strscan'

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

  it "returns the number of bytes advanced and advances the scan pointer until pattern is matched and consumed" do
    @s.skip_until(/a/).should == 9
    @s.pos.should == 9
    @s.matched.should == "a"
  end

  it "returns nil if no match was found" do
    @s.skip_until(/d+/).should == nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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