caolan / caolan/nodeunit

test.equal prints values in incorrect order for Boolean values

オープン
#175 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
1.9k
フォーク
359
PR マージ指標
30日以内にマージされた PR はありません

説明

test.equal(1, 2) prints values in this order
test.equal(false, true) prints values in reverse order
## reproduction printout

```
$ nodeunit ../nodejs3/snippets/modules/nodeunit/nodeunit-order.js

nodeunit-order.js
assert module works as expected
BUG: As of nodeunit 0.7.4, the order of the boolean values is swapped.
The second error should be "AssertionError: false == true" not "AssertionError: true == false"
✖ f

AssertionError: 1 == 2
at Object.assertWrapper [as equal] (/usr/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at Object.module.exports.f (/home/foxyboy/Desktop/c505/node/nodejs3/snippets/modules/nodeunit/nodeunit-order.js:25:7)
at Object.wrapTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:235:16)
at wrapTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:235:16)
at Object.exports.runTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:69:9)
at exports.runSuite (/usr/local/lib/node_modules/nodeunit/lib/core.js:117:25)
at _concat (/usr/local/lib/node_modules/nodeunit/deps/async.js:508:13)
at async.forEachSeries.iterate (/usr/local/lib/node_modules/nodeunit/deps/async.js:118:13)
at async.forEachSeries (/usr/local/lib/node_modules/nodeunit/deps/async.js:134:9)
at _concat (/usr/local/lib/node_modules/nodeunit/deps/async.js:507:9)

AssertionError: true == false
at Object.assertWrapper [as equal] (/usr/local/lib/node_modules/nodeunit/lib/types.js:83:39)
at Object.module.exports.f (/home/foxyboy/Desktop/c505/node/nodejs3/snippets/modules/nodeunit/nodeunit-order.js:26:7)
at Object.wrapTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:235:16)
at wrapTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:235:16)
at Object.exports.runTest (/usr/local/lib/node_modules/nodeunit/lib/core.js:69:9)
at exports.runSuite (/usr/local/lib/node_modules/nodeunit/lib/core.js:117:25)
at _concat (/usr/local/lib/node_modules/nodeunit/deps/async.js:508:13)
at async.forEachSeries.iterate (/usr/local/lib/node_modules/nodeunit/deps/async.js:118:13)
at async.forEachSeries (/usr/local/lib/node_modules/nodeunit/deps/async.js:134:9)
at _concat (/usr/local/lib/node_modules/nodeunit/deps/async.js:507:9)

FAILURES: 2/2 assertions failed (4ms)
```
## reproduction code

``` js
// nodeunit-order.js

var assert = require('assert')

module.exports.f = function (test) {

// check assert
try {
assert.equal(1, 2)
} catch(e) {
if (e.toString() != 'AssertionError: 1 == 2') throw Error()
}
try {
assert.equal(false, true)
} catch(e) {
if (e.toString() != 'AssertionError: false == true') throw Error(e)
}
console.log('assert module works as expected')

console.log('BUG: As of nodeunit 0.7.4, the order of the boolean values is swapped.')
console.log('The second error should be ' +
'"AssertionError: false == true"' +
' not ' +
'"AssertionError: true == false"')
test.equal(1, 2)
test.equal(false, true)
test.done()
}
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。