summaryrefslogtreecommitdiff
path: root/spec/ruby/core/matchdata/string_spec.rb
blob: 793684d36a8b09fd8f6a05c660918c5750c63fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require File.expand_path('../../../spec_helper', __FILE__)

describe "MatchData#string" do
  it "returns a copy of the match string" do
    str = /(.)(.)(\d+)(\d)/.match("THX1138.").string
    str.should == "THX1138."
  end

  it "returns a frozen copy of the match string" do
    str = /(.)(.)(\d+)(\d)/.match("THX1138.").string
    str.should == "THX1138."
    str.frozen?.should == true
  end
end