Skip to content

Commit

Permalink
[Test] skip function toString check for nullish values
Browse files Browse the repository at this point in the history
This fails in Opera 11.1 and 11.5, and doesn’t add anything for nullish values anyways
  • Loading branch information
ljharb committed Sep 15, 2022
1 parent a501141 commit 8698116
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions test/index.js
Expand Up @@ -91,18 +91,20 @@ test('not callables', function (t) {
t.comment('FF 3.6 has a Function toString that coerces its receiver, so this test is skipped');
return;
}
if (isFirefox && nonFunction == null) { // eslint-disable-line eqeqeq
if (nonFunction != null) { // eslint-disable-line eqeqeq
if (isFirefox) {
// Firefox 3 throws some kind of *object* here instead of a proper error
t['throws'](
function () { Function.prototype.toString.call(nonFunction); },
inspect(nonFunction) + ' can not be used with Function toString'
);
} else {
t['throws'](
function () { Function.prototype.toString.call(nonFunction); },
TypeError,
inspect(nonFunction) + ' can not be used with Function toString'
);
t['throws'](
function () { Function.prototype.toString.call(nonFunction); },
inspect(nonFunction) + ' can not be used with Function toString'
);
} else {
t['throws'](
function () { Function.prototype.toString.call(nonFunction); },
TypeError,
inspect(nonFunction) + ' can not be used with Function toString'
);
}
}
t.equal(isCallable(nonFunction), false, inspect(nonFunction) + ' is not callable');
});
Expand Down

0 comments on commit 8698116

Please sign in to comment.