mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
773 B
33 lines
773 B
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
// no args
|
|
assert.throws(
|
|
() => { assert.fail(); },
|
|
/^AssertionError: undefined undefined undefined$/
|
|
);
|
|
|
|
// one arg = message
|
|
assert.throws(
|
|
() => { assert.fail('custom message'); },
|
|
/^AssertionError: custom message$/
|
|
);
|
|
|
|
// two args only, operator defaults to '!='
|
|
assert.throws(
|
|
() => { assert.fail('first', 'second'); },
|
|
/^AssertionError: 'first' != 'second'$/
|
|
);
|
|
|
|
// three args
|
|
assert.throws(
|
|
() => { assert.fail('ignored', 'ignored', 'another custom message'); },
|
|
/^AssertionError: another custom message$/
|
|
);
|
|
|
|
// no third arg (but a fourth arg)
|
|
assert.throws(
|
|
() => { assert.fail('first', 'second', undefined, 'operator'); },
|
|
/^AssertionError: 'first' operator 'second'$/
|
|
);
|
|
|