caolan / caolan/nodeunit

test.equal prints values in incorrect order for Boolean values

Offen
#175 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
1.9k
Forks
359
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.