On 06/06/14 11:41, Gijs Kruitbosch wrote: > On 06/06/2014 10:29, James Graham wrote: >> On 05/06/14 10:38, Mike de Boer wrote: >> >>> As I tried to explain, the CommonJS API naively made sense to me at >>> the time. To others as well, because we’re happily using it. As I now >>> understand, some of us are very attached to a specific, different, >>> API. >> >> FWIW I don't think that I am attached to a "specific different api". I >> am, however, attached to api semantics that make writing good tests >> easy. I don't think that either CommonJS or SimpleTest achieve this in >> their current form. For SimpltTest I think the main problems are: >> >> * The is() and isnot methods use non-strict equality. > > I will go ahead and assert that if you have a test that relies on strict > versus non-strict equality, you should be using type checks to make that > explicit, not an extra '=' in your comparisons. Makes assumptions much > more explicit ("this return value should be a string '5' and not a > number 5") rather than implied by the comparison function. > > IOW, I wouldn't consider this a bug.
So you believe that every single time you write is(some_func(), 5) you should also write is(typeof some_func(), "number") ? That seems pretty much insane to me and I will happily assert that no one actually does it consistently. If there are cases where you really don't care about the type — and I can't think of very many — then in those cases you should explicitly type convert as a signal that you are doing something strange. >> * ok() coerces its argument (this is a more minor problem). > > I would even say s/more minor problem/feature/. > > I've lost count of the number of times I've done: > > ok(document.getElementById("foo"), "Foo should exist in the document") So what you are checking for there is !== null, not "is a thing that coerces to true". But like I said this is a more minor concern. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform