tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

Test for "new Boolean(false)" #171

Closed ROMB closed 10 years ago

ROMB commented 10 years ago

This is must not be false, as result of new Boolean(false) is object.

btd commented 10 years ago

should.js unwrap all primitive type wrappers to their actual values. it is by design true.

ROMB commented 10 years ago

But should thinks it's false. Try the test.

btd commented 10 years ago

I know the test will fail. But test from should.js perspective is wrong.

From logical point of view, why you think we should not extract from Boolean its value?

ROMB commented 10 years ago

because if(new Boolean(false)) will be true.

ROMB commented 10 years ago

This is mistake that some one can make in javascript code if(Boolean(false)) - false if(new Boolean(false)) - true