diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-03-28 00:22:51 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-03-28 00:22:51 +0100 |
commit | f234d51eaba861edea925eabb564a0bee41b96a0 (patch) | |
tree | 3334f36a91fe81ec704f2980ab169231f52c41d0 /spec/ruby/core/regexp | |
parent | 296f68816cf575b3ff920f92aec8a4109a7d81d4 (diff) | |
download | ruby-f234d51eaba861edea925eabb564a0bee41b96a0.tar.gz |
Update to ruby/spec@ec84479
Diffstat (limited to 'spec/ruby/core/regexp')
-rw-r--r-- | spec/ruby/core/regexp/union_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/regexp/union_spec.rb b/spec/ruby/core/regexp/union_spec.rb index 81a31d89b3..8076836471 100644 --- a/spec/ruby/core/regexp/union_spec.rb +++ b/spec/ruby/core/regexp/union_spec.rb @@ -139,6 +139,16 @@ describe "Regexp.union" do Regexp.union(obj, "bar").should == /foo|bar/ end + it "uses to_regexp to convert argument" do + obj = mock('pattern') + obj.should_receive(:to_regexp).and_return(/foo/) + Regexp.union(obj).should == /foo/ + end + + it "accepts a Symbol as argument" do + Regexp.union(:foo).should == /foo/ + end + it "accepts a single array of patterns as arguments" do Regexp.union(["skiing", "sledding"]).should == /skiing|sledding/ not_supported_on :opal do |