Sha256: 71a88235bea473d99190dcc67e973dc5530ec8a7c7eea7658b25f9274f83d378

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 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

1 entries across 1 versions & 1 rubygems

Version Path
sc-core-ext-1.1.1 spec/sc-core-ext/regexp_spec.rb