Skip to content

Commit

Permalink
test: assert - fixed error messages to match the tests
Browse files Browse the repository at this point in the history
PR-URL: #6241
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
suryagh authored and MylesBorins committed Apr 21, 2016
1 parent fb2a978 commit df93d6b
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,46 @@ assert.doesNotThrow(makeBlock(a.ok, true),

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),
a.AssertionError, 'notEqual');
a.AssertionError, 'notEqual(true, true)');

assert.throws(makeBlock(a.strictEqual, 2, '2'),
a.AssertionError, 'strictEqual');
a.AssertionError, 'strictEqual(2, \'2\')');

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!
// 7.2
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)),
a.AssertionError,
'deepEqual date');
'deepEqual(new Date(), new Date(2000, 3, 14))');

// 7.3
assert.doesNotThrow(makeBlock(a.deepEqual, /a/, /a/));
Expand All @@ -81,11 +88,11 @@ assert.throws(makeBlock(a.deepEqual, /a/igm, /a/im));


// 7.4
assert.doesNotThrow(makeBlock(a.deepEqual, 4, '4'), 'deepEqual == check');
assert.doesNotThrow(makeBlock(a.deepEqual, true, 1), 'deepEqual == check');
assert.doesNotThrow(makeBlock(a.deepEqual, 4, '4'), 'deepEqual(4, \'4\')');
assert.doesNotThrow(makeBlock(a.deepEqual, true, 1), 'deepEqual(true, 1)');
assert.throws(makeBlock(a.deepEqual, 4, '5'),
a.AssertionError,
'deepEqual == check');
'deepEqual( 4, \'5\')');

// 7.5
// having the same number of owned properties && the same set of keys
Expand Down Expand Up @@ -156,11 +163,13 @@ assert.doesNotThrow(makeBlock(a.deepEqual, new Boolean(true), {}),

//deepStrictEqual
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)),
a.AssertionError,
'deepStrictEqual date');
'deepStrictEqual(new Date(), new Date(2000, 3, 14))');

// 7.3 - strict
assert.doesNotThrow(makeBlock(a.deepStrictEqual, /a/, /a/));
Expand All @@ -183,15 +192,15 @@ assert.throws(makeBlock(a.deepStrictEqual, /a/igm, /a/im));
// 7.4 - strict
assert.throws(makeBlock(a.deepStrictEqual, 4, '4'),
a.AssertionError,
'deepStrictEqual === check');
'deepStrictEqual(4, \'4\')');

assert.throws(makeBlock(a.deepStrictEqual, true, 1),
a.AssertionError,
'deepStrictEqual === check');
'deepStrictEqual(true, 1)');

assert.throws(makeBlock(a.deepStrictEqual, 4, '5'),
a.AssertionError,
'deepStrictEqual === check');
'deepStrictEqual(4, \'5\')');

// 7.5 - strict
// having the same number of owned properties && the same set of keys
Expand Down

0 comments on commit df93d6b

Please sign in to comment.