diff options
Diffstat (limited to 'spec/ruby/core/regexp/equal_value_spec.rb')
| -rw-r--r-- | spec/ruby/core/regexp/equal_value_spec.rb | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/spec/ruby/core/regexp/equal_value_spec.rb b/spec/ruby/core/regexp/equal_value_spec.rb index 4ddaec8e4e..ad8dc33222 100644 --- a/spec/ruby/core/regexp/equal_value_spec.rb +++ b/spec/ruby/core/regexp/equal_value_spec.rb @@ -1,6 +1,33 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../shared/equal_value', __FILE__) +require_relative '../../spec_helper' describe "Regexp#==" do - it_behaves_like :regexp_eql, :== + it "is true if self and other have the same pattern" do + (/abc/ == /abc/).should == true + (/abc/ == /abd/).should == false + end + + not_supported_on :opal do + it "is true if self and other have the same character set code" do + (/abc/ == /abc/x).should == false + (/abc/x == /abc/x).should == true + (/abc/u == /abc/n).should == false + (/abc/u == /abc/u).should == true + (/abc/n == /abc/n).should == true + end + end + + it "is true if other has the same #casefold? values" do + (/abc/ == /abc/i).should == false + (/abc/i == /abc/i).should == true + end + + not_supported_on :opal do + it "is true if self does not specify /n option and other does" do + (// == //n).should == true + end + + it "is true if self specifies /n option and other does not" do + (//n == //).should == true + end + end end |
