numbers / numbers.js

Advanced Mathematics Library for Node.js and JavaScript
Apache License 2.0
1.77k stars 167 forks source link

assert.equal() and assert.deepEqual() used incorrectly #112

Closed LarryBattle closed 9 years ago

LarryBattle commented 9 years ago

Not really a bug but could potentially lead to misleading error messages during testing. The problem is that most of the test cases supply the expected value as the actual value and vice versa for assert.equal() and assert.deepEqual().

_Node 0.10.x Assertion Signatures:_

Example of incorrect usage. File: complex.test.js Line: 16 Code:

assert.equal(10, res.im);

Should be: Code:

assert.equal(res.im, 10);

Matrix.test.js is the only file that uses assert.deepEqual() and assert.equal() correctly.

I'll try to submit a pull request if I have time this week.

Dakkers commented 9 years ago

@LarryBattle cool, thanks for noticing this. if you find yourself too busy, I can take a look.

LarryBattle commented 9 years ago

Used jsfmt for the job.

Code:

 jsfmt --rewrite "assert.deepEqual(a,b) -> assert.deepEqual(b,a)" !(m*.*) --write
 jsfmt --rewrite "assert.equal(a,b) -> assert.equal(b,a)" !(m*.*) --write

Will make pull request soon.