diff options
Diffstat (limited to 'spec/ruby/core/matchdata/string_spec.rb')
-rw-r--r-- | spec/ruby/core/matchdata/string_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/string_spec.rb b/spec/ruby/core/matchdata/string_spec.rb new file mode 100644 index 0000000000..793684d36a --- /dev/null +++ b/spec/ruby/core/matchdata/string_spec.rb @@ -0,0 +1,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 |