Skip to content

Commit

Permalink
NuRegex isEqual: was incorrectly assuming its argument was a NuRegex.…
Browse files Browse the repository at this point in the history
… Fixed.
  • Loading branch information
timburks committed Jan 13, 2011
1 parent e79c2c1 commit 4f8a2d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion objc/NuRegex.m
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ - (const pcre *)pcre { return regex; }

- (BOOL)isEqual:(NuRegex *)other
{
return (([pattern isEqual: [other pattern]]) && (options == [other options]));
return ([other isKindOfClass:[NuRegex class]] && [pattern isEqual:[other pattern]] && (options == [other options]));
}

@end
Expand Down
4 changes: 3 additions & 1 deletion test/test_regex.nu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
(assert_equal /extended/x /extended/x)
(assert_equal /a(.*)z/ /a(.*)z/)
(assert_not_equal /hello/ /goodbye/)
(assert_not_equal /extended/x /extended/)))
(assert_not_equal /extended/x /extended/)
(assert_not_equal /foo/ nil)
(assert_not_equal /foo/ "foo")))



0 comments on commit 4f8a2d8

Please sign in to comment.