tj / should.js

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

Ignore \r in equals #85

Closed ForbesLindesay closed 12 years ago

ForbesLindesay commented 12 years ago

Would you consider making the default behaviour of equals be to ignore the difference between \r and \r\n in strings except where an explicit option to include-r is added. My feeling is that it's only ever really worthwhile checking for that difference when unit testing a library intended to swap \r\n for \n or visa versa. It breaks the unit tests of loads and loads of libraries when you run them on windows but pretty much never causes a problem with the actual code.

tj commented 12 years ago

personally no, because if you're writing say an HTTP lib you would explicitly want CRLF, or SMTP etc

tj commented 12 years ago

it's more an issue of Mocha (and friends) displaying the difference poorly haha, especially mocha's diffs right now

ForbesLindesay commented 12 years ago

OK, failing that, you could add an ignore line endings option? It is often the case (say when rendering templates etc.)

tj commented 12 years ago

meh I dont think it's a concern for should, I've done things like foo.should.equal(bar.trim()) of course, but it's easy to do those sorts of things without modifying should in strange opinionated ways

ForbesLindesay commented 12 years ago

Fair enuf