diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
commit | 1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch) | |
tree | a3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/language/regexp/back-references_spec.rb | |
parent | 75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff) |
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
[Misc #13792] [ruby-core:82287]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/language/regexp/back-references_spec.rb')
-rw-r--r-- | spec/rubyspec/language/regexp/back-references_spec.rb | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/spec/rubyspec/language/regexp/back-references_spec.rb b/spec/rubyspec/language/regexp/back-references_spec.rb deleted file mode 100644 index 607f4463fd..0000000000 --- a/spec/rubyspec/language/regexp/back-references_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../../fixtures/classes', __FILE__) - -describe "Regexps with back-references" do - it "saves match data in the $~ pseudo-global variable" do - "hello" =~ /l+/ - $~.to_a.should == ["ll"] - end - - it "saves captures in numbered $[1-9] variables" do - "1234567890" =~ /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/ - $~.to_a.should == ["1234567890", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] - $1.should == "1" - $2.should == "2" - $3.should == "3" - $4.should == "4" - $5.should == "5" - $6.should == "6" - $7.should == "7" - $8.should == "8" - $9.should == "9" - end - - it "will not clobber capture variables across threads" do - cap1, cap2, cap3 = nil - "foo" =~ /(o+)/ - cap1 = [$~.to_a, $1] - Thread.new do - cap2 = [$~.to_a, $1] - "bar" =~ /(a)/ - cap3 = [$~.to_a, $1] - end.join - cap4 = [$~.to_a, $1] - cap1.should == [["oo", "oo"], "oo"] - cap2.should == [[], nil] - cap3.should == [["a", "a"], "a"] - cap4.should == [["oo", "oo"], "oo"] - end - - it "supports \<n> (backreference to previous group match)" do - /(foo.)\1/.match("foo1foo1").to_a.should == ["foo1foo1", "foo1"] - /(foo.)\1/.match("foo1foo2").should be_nil - end - - it "resets nested \<n> backreference before match of outer subexpression" do - /(a\1?){2}/.match("aaaa").to_a.should == ["aa", "a"] - end -end |