relevance / blue-ridge

Framework for JavaScript Testing (currently a Rails Plugin)
http://groups.google.com/group/blueridgejs
MIT License
480 stars 40 forks source link

Matchers are too loose #20

Open ConradIrwin opened 15 years ago

ConradIrwin commented 15 years ago

in javascript: 0, 0.0, null, undefined, '', ' ', etc. all evaluate to false when cast to a boolean, and almost everything else evaluates to true. the be_true and be_false method should not just check actual and !actual, but (actual === true) and (actual === false).

A similar issue is present with be_null, be_undefined and equal, (false == 0, false !== 0, null == undefined, but null !== undefined).

kristopher commented 15 years ago

Agreed the == operators type coercion is a tricky thing to deal with in javascript testing frameworks almost all the frameworks I've looked at handle their equal and be matchers differently. Some of these issues you stated are fixed in my or other peoples forks of screw-unit they just haven't been pull into blue ridge yet.

karnowski commented 15 years ago

I'll be updating Screw.Unit soon, so I'll try to find a patch that fixes this. Thanks for the heads up Conrad and Kristopher.