[OpenLayers-Dev] Testing: prefer t.eq to t.ok(foo == bar)

Christopher Schmidt crschmidt at metacarta.com
Tue Oct 2 20:36:01 EDT 2007

Andreas -- 

I just noticed this in your code, but it applies to many other
developers as well, so I'm going to use you as an example:


, you use:         t.ok(rule.evaluate(feature) == false, "text")

While this is acceptable for when the test succeeds, it's difficult in
the future when the test fails to track down exactly what is failing.

t.eq(rule.evaluate(feature), false, "text")

Is more informative, because in the case where it fails, it will say
something like:

 "got null, expected false"

which is useful for tracking down the why of the failure.

If you could rewrite the tests to use this instead, that would be great.

(I'm really excited about getting this into trunk, though it's probably
not clear from my criticsms. :) Just want to make the integration
process as easy as possible.)

Christopher Schmidt

More information about the Dev mailing list