caolan / caolan/nodeunit

test.equal prints values in incorrect order for Boolean values

Đang mở
#175 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
1.9k
Fork
359
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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()
}
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.