You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason it should pass is that, IMO, toEqual for regexes should compare only source, global, ignoreCase, multiline, and sticky properties, since those are the only properties that are generally relevant for regex objects. For comparison, that's how QUnit's deepEqual works for regex objects. Also, copying a regex using new RegExp(regexp) does not preserve other properties.
Accepting pull request #234 should fix all of these cases, but I figured my first two examples here, at least, needed their own issue. Even if #234 isn't accepted, expect(/a/).toEqual(/b/) obviously should not pass. This is causing a significant number of my tests to break.
The text was updated successfully, but these errors were encountered:
This is fixed on a branch - matchers_redo. We've moved to a new equals function based on what Underscore does. It's much better overall and handles RegExps (and Dates, etc.) much better than Jasmine's 1.x equals_ function.
Expect this to be on Jasmine master in a couple of days and will definitely be in the next 2.0 pre-release.
This should not pass, but does:
This should not pass, but does:
This should pass, but does not:
The reason it should pass is that, IMO,
toEqual
for regexes should compare onlysource
,global
,ignoreCase
,multiline
, andsticky
properties, since those are the only properties that are generally relevant for regex objects. For comparison, that's how QUnit'sdeepEqual
works for regex objects. Also, copying a regex usingnew RegExp(regexp)
does not preserve other properties.Accepting pull request #234 should fix all of these cases, but I figured my first two examples here, at least, needed their own issue. Even if #234 isn't accepted,
expect(/a/).toEqual(/b/)
obviously should not pass. This is causing a significant number of my tests to break.The text was updated successfully, but these errors were encountered: