summaryrefslogtreecommitdiff
path: root/spec/ruby/core/regexp/equal_value_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/regexp/equal_value_spec.rb')
-rw-r--r--spec/ruby/core/regexp/equal_value_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/ruby/core/regexp/equal_value_spec.rb b/spec/ruby/core/regexp/equal_value_spec.rb
new file mode 100644
index 0000000000..ad8dc33222
--- /dev/null
+++ b/spec/ruby/core/regexp/equal_value_spec.rb
@@ -0,0 +1,33 @@
+require_relative '../../spec_helper'
+
+describe "Regexp#==" do
+ 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