Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Regexp #== and #eql? is true if self does not specify /n option and other does and vise versa #694

Merged
merged 1 commit into from

2 participants

@atambo
Collaborator

No description provided.

@headius headius merged commit 443ddb6 into jruby:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 2, 2013
  1. @atambo
This page is out of date. Refresh to see the latest.
View
2  spec/tags/1.9/ruby/core/regexp/eql_tags.txt
@@ -1,2 +0,0 @@
-fails:Regexp#eql? is true if self does not specify /n option and other does
-fails:Regexp#eql? is true if self specifies /n option and other does not
View
2  spec/tags/1.9/ruby/core/regexp/equal_value_tags.txt
@@ -1,2 +0,0 @@
-fails:Regexp#== is true if self does not specify /n option and other does
-fails:Regexp#== is true if self specifies /n option and other does not
View
21 src/org/jruby/util/RegexpOptions.java
@@ -253,14 +253,19 @@ public boolean equals(Object other) {
// sake of equality we ignore those two fields since those flags do
// not affect Ruby equality.
RegexpOptions o = (RegexpOptions)other;
- return o.encodingNone == encodingNone &&
- o.extended == extended &&
- o.fixed == fixed &&
- o.ignorecase == ignorecase &&
- o.java == java &&
- o.kcode == kcode &&
- o.kcodeDefault == kcodeDefault &&
- o.multiline == multiline;
+ boolean equality = o.extended == extended &&
+ o.fixed == fixed &&
+ o.ignorecase == ignorecase &&
+ o.java == java &&
+ o.multiline == multiline;
+ if(encodingNone || o.encodingNone) {
+ return equality && o.kcode == kcode;
+ } else {
+ return equality &&
+ o.encodingNone == encodingNone &&
+ o.kcode == kcode &&
+ o.kcodeDefault == kcodeDefault;
+ }
}
@Override
Something went wrong with that request. Please try again.