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

Andreas Hocevar andreas.hocevar at gmail.com
Tue Oct 2 23:25:20 EDT 2007


thank you for this important hint!  I changed all my tests to comply
with that. Also, I pulled the latest trunk version into the
sldRenderer sandbox, built a singlefile version of OpenLayers.js to
check for correct @requires statements and dependencies, and used this
successfully with the gml-layer-sld.html example.


On 10/2/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> 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:
> In
> http://trac.openlayers.org/browser/sandbox/ahocevar/sldRenderer/tests/Rule/test_Logical.html?rev=4759
> , 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.)
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

More information about the Dev mailing list