mirror of https://github.com/nodejs/node.git
34 lines
773 B
JavaScript
34 lines
773 B
JavaScript
'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'$/
|
|
);
|