Browse Source

test: assert - fixed error messages to match the tests

PR-URL: https://github.com/nodejs/node/pull/6241
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
process-exit-stdio-flushing
surya panikkal 9 years ago
committed by James M Snell
parent
commit
aa4d2ae897
  1. 51
      test/parallel/test-assert.js

51
test/parallel/test-assert.js

@ -27,39 +27,46 @@ assert.doesNotThrow(makeBlock(a.ok, true),
assert.doesNotThrow(makeBlock(a.ok, 'test'), 'ok(\'test\')'); assert.doesNotThrow(makeBlock(a.ok, 'test'), 'ok(\'test\')');
assert.throws(makeBlock(a.equal, true, false), a.AssertionError, 'equal'); assert.throws(makeBlock(a.equal, true, false),
a.AssertionError, 'equal(true, false)');
assert.doesNotThrow(makeBlock(a.equal, null, null), 'equal'); assert.doesNotThrow(makeBlock(a.equal, null, null),
'equal(null, null)');
assert.doesNotThrow(makeBlock(a.equal, undefined, undefined), 'equal'); assert.doesNotThrow(makeBlock(a.equal, undefined, undefined),
'equal(undefined, undefined)');
assert.doesNotThrow(makeBlock(a.equal, null, undefined), 'equal'); assert.doesNotThrow(makeBlock(a.equal, null, undefined),
'equal(null, undefined)');
assert.doesNotThrow(makeBlock(a.equal, true, true), 'equal'); assert.doesNotThrow(makeBlock(a.equal, true, true), 'equal(true, true)');
assert.doesNotThrow(makeBlock(a.equal, 2, '2'), 'equal'); assert.doesNotThrow(makeBlock(a.equal, 2, '2'), 'equal(2, \'2\')');
assert.doesNotThrow(makeBlock(a.notEqual, true, false), 'notEqual'); assert.doesNotThrow(makeBlock(a.notEqual, true, false),
'notEqual(true, false)');
assert.throws(makeBlock(a.notEqual, true, true), assert.throws(makeBlock(a.notEqual, true, true),
a.AssertionError, 'notEqual'); a.AssertionError, 'notEqual(true, true)');
assert.throws(makeBlock(a.strictEqual, 2, '2'), assert.throws(makeBlock(a.strictEqual, 2, '2'),
a.AssertionError, 'strictEqual'); a.AssertionError, 'strictEqual(2, \'2\')');
assert.throws(makeBlock(a.strictEqual, null, undefined), assert.throws(makeBlock(a.strictEqual, null, undefined),
a.AssertionError, 'strictEqual'); a.AssertionError, 'strictEqual(null, undefined)');
assert.doesNotThrow(makeBlock(a.notStrictEqual, 2, '2'), 'notStrictEqual'); assert.doesNotThrow(makeBlock(a.notStrictEqual, 2, '2'),
'notStrictEqual(2, \'2\')');
// deepEquals joy! // deepEquals joy!
// 7.2 // 7.2
assert.doesNotThrow(makeBlock(a.deepEqual, new Date(2000, 3, 14), assert.doesNotThrow(makeBlock(a.deepEqual, new Date(2000, 3, 14),
new Date(2000, 3, 14)), 'deepEqual date'); new Date(2000, 3, 14)),
'deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))');
assert.throws(makeBlock(a.deepEqual, new Date(), new Date(2000, 3, 14)), assert.throws(makeBlock(a.deepEqual, new Date(), new Date(2000, 3, 14)),
a.AssertionError, a.AssertionError,
'deepEqual date'); 'deepEqual(new Date(), new Date(2000, 3, 14))');
// 7.3 // 7.3
assert.doesNotThrow(makeBlock(a.deepEqual, /a/, /a/)); assert.doesNotThrow(makeBlock(a.deepEqual, /a/, /a/));
@ -81,11 +88,11 @@ assert.throws(makeBlock(a.deepEqual, /a/igm, /a/im));
// 7.4 // 7.4
assert.doesNotThrow(makeBlock(a.deepEqual, 4, '4'), 'deepEqual == check'); assert.doesNotThrow(makeBlock(a.deepEqual, 4, '4'), 'deepEqual(4, \'4\')');
assert.doesNotThrow(makeBlock(a.deepEqual, true, 1), 'deepEqual == check'); assert.doesNotThrow(makeBlock(a.deepEqual, true, 1), 'deepEqual(true, 1)');
assert.throws(makeBlock(a.deepEqual, 4, '5'), assert.throws(makeBlock(a.deepEqual, 4, '5'),
a.AssertionError, a.AssertionError,
'deepEqual == check'); 'deepEqual( 4, \'5\')');
// 7.5 // 7.5
// having the same number of owned properties && the same set of keys // having the same number of owned properties && the same set of keys
@ -156,11 +163,13 @@ assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}),
//deepStrictEqual //deepStrictEqual
assert.doesNotThrow(makeBlock(a.deepStrictEqual, new Date(2000, 3, 14), assert.doesNotThrow(makeBlock(a.deepStrictEqual, new Date(2000, 3, 14),
new Date(2000, 3, 14)), 'deepStrictEqual date'); new Date(2000, 3, 14)),
'deepStrictEqual(new Date(2000, 3, 14),\
new Date(2000, 3, 14))');
assert.throws(makeBlock(a.deepStrictEqual, new Date(), new Date(2000, 3, 14)), assert.throws(makeBlock(a.deepStrictEqual, new Date(), new Date(2000, 3, 14)),
a.AssertionError, a.AssertionError,
'deepStrictEqual date'); 'deepStrictEqual(new Date(), new Date(2000, 3, 14))');
// 7.3 - strict // 7.3 - strict
assert.doesNotThrow(makeBlock(a.deepStrictEqual, /a/, /a/)); assert.doesNotThrow(makeBlock(a.deepStrictEqual, /a/, /a/));
@ -183,15 +192,15 @@ assert.throws(makeBlock(a.deepStrictEqual, /a/igm, /a/im));
// 7.4 - strict // 7.4 - strict
assert.throws(makeBlock(a.deepStrictEqual, 4, '4'), assert.throws(makeBlock(a.deepStrictEqual, 4, '4'),
a.AssertionError, a.AssertionError,
'deepStrictEqual === check'); 'deepStrictEqual(4, \'4\')');
assert.throws(makeBlock(a.deepStrictEqual, true, 1), assert.throws(makeBlock(a.deepStrictEqual, true, 1),
a.AssertionError, a.AssertionError,
'deepStrictEqual === check'); 'deepStrictEqual(true, 1)');
assert.throws(makeBlock(a.deepStrictEqual, 4, '5'), assert.throws(makeBlock(a.deepStrictEqual, 4, '5'),
a.AssertionError, a.AssertionError,
'deepStrictEqual === check'); 'deepStrictEqual(4, \'5\')');
// 7.5 - strict // 7.5 - strict
// having the same number of owned properties && the same set of keys // having the same number of owned properties && the same set of keys

Loading…
Cancel
Save