On 2015-05-14 8:03 AM, Mike de Boer wrote:
On 14 May 2015, at 03:15, Boris Zbarsky <bzbar...@mit.edu> wrote:
On 5/13/15 7:35 PM, Gregory Szorc wrote:
I would steer people in the direction of Assert.jsm, specifically
Assert.deepEqual
This should be used very very carefully.
As a very simple example, using this (or worse yet notDeepEqual) in any test
that tries to check for equality of Window objects is not a good idea.
The idea is *I think* that ObjectUtils.jsm (which Assert.jsm uses since
recently) can be extended to be aware of various object types. Right now it
doesn’t have optimal support for iterables like `Map` and `Set`. Same goes for
Gecko wrapper objects, like `window`. When you want to use `deepEqual` with
those, anyone should feel free to add support for it! Even if it’s only
rudimentary support only.
But the point is that there is no use to deep comparing something like
two window objects. If you are doing that, you're almost definitely
doing something wrong.
This is why usage of these Assert.jsm functions should be highly
discouraged at least in tests examining the Web platform. The semantics
are too hard to understand, and they may not be what we want (as is the
case with the deep equality checks) at all.
(FWIW, I noticed recently that someone had edited the Mochitest MDN page
claiming that the usage of Assert.jsm is encouraged. I have updated
that page to match the reality.)
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform