Sha256: 42369c971e25eead1fccdf15705b41b0e903b2554744f0682a71fb6132c711a9

Contents?: true

Size: 451 Bytes

Versions: 3

Compression:

Stored size: 451 Bytes

Contents

require 'spec_helper'

describe Regexp do
  before(:each) { @demo_text = "123abc\n asdf0987 \na1234"}

  it "should yield all matches in a multiline regexp" do
    @rx = /([0-9]+)/m
    yielded = 0
    @rx.each_match(@demo_text) { |y| yielded += 1 }
    yielded.should == 3
  end

  it "should return all matches in a multiline regexp" do
    @rx = /([0-9]+)/m
    @rx.each_match(@demo_text).collect { |m| m[0] }.should == %w(123 0987 1234)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sc-core-ext-1.2.1 spec/sc-core-ext/regexp_spec.rb
sc-core-ext-1.2.0 spec/sc-core-ext/regexp_spec.rb
sc-core-ext-1.0.0 spec/sc-core-ext/regexp_spec.rb