Merge pull request #1978 from tc39/eliminate-some-false-positives

Eliminate some false positives
This commit is contained in:
Leo Balter 2018-11-30 11:54:12 -05:00 committed by GitHub
commit 31e654a339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 180 additions and 96 deletions

View File

@ -8,6 +8,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
var a = [];
a.constructor = null;
assert.throws(TypeError, function() {

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
assert.throws(TypeError, function() {
[].flat.call(null);
}, 'null value');

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
assert.throws(TypeError, function() {
[].flat(Symbol());
}, 'symbol value');

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert(Array.prototype.flatMap);
assert.throws(TypeError, function() {
[].flatMap({});
}, 'non callable argument');

View File

@ -8,6 +8,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
var a = [];
a.constructor = null;
assert.throws(TypeError, function() {

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
assert.throws(TypeError, function() {
[].flatMap.call(null);
}, 'null value');

View File

@ -17,10 +17,12 @@ info: |
b. Let exists be ? HasProperty(source, P).
c. If exists is true, then
i. Let element be ? Get(source, P).
features: [Array.prototype.flat]
features: [Array.prototype.flatMap]
includes: [compareArray.js]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
const getCalls = [], hasCalls = [];
const handler = {
get : function (t, p, r) { getCalls.push(p); return Reflect.get(t, p, r); },

View File

@ -9,7 +9,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
assert.throws(TypeError, function() {
BigInt.asIntN(0, undefined);
}, "ToBigInt: undefined => TypeError");

View File

@ -9,7 +9,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
function err() {
throw new Test262Error();
}

View File

@ -9,6 +9,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
assert.throws(RangeError, function() {
BigInt.asIntN(-1, 0n);

View File

@ -9,6 +9,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
function err() {
throw new Test262Error();

View File

@ -9,6 +9,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
assert.throws(TypeError, function() {
BigInt.asUintN(0, undefined);

View File

@ -9,6 +9,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
function err() {
throw new Test262Error();

View File

@ -9,6 +9,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
assert.throws(RangeError, function() {
BigInt.asUintN(-1, 0n);

View File

@ -9,6 +9,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
function err() {
throw new Test262Error();

View File

@ -9,6 +9,7 @@ info: |
...
features: [BigInt]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.throws(TypeError, function() {
new BigInt();

View File

@ -15,6 +15,7 @@ info: |
[[BigIntData]] internal slot.
features: [BigInt]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.throws(TypeError, function() {
BigInt.prototype.toString(1);

View File

@ -21,6 +21,8 @@ features: [BigInt, Symbol, Symbol.toPrimitive]
var toString = BigInt.prototype.toString;
assert.sameValue(typeof toString, 'function');
assert.throws(TypeError, function() {
toString.call({
x: 1n

View File

@ -20,6 +20,7 @@ features: [BigInt]
---*/
var valueOf = BigInt.prototype.valueOf;
assert.sameValue(typeof valueOf, 'function');
assert.throws(TypeError, function() {
valueOf.call({});

View File

@ -21,6 +21,8 @@ features: [BigInt, Symbol]
var valueOf = BigInt.prototype.valueOf;
assert.sameValue(typeof valueOf, 'function');
assert.throws(TypeError, function() {
valueOf.call(undefined);
}, "undefined");

View File

@ -49,6 +49,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -49,6 +49,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -45,6 +45,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -36,6 +36,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -14,6 +14,7 @@ info: |
features: [Object.fromEntries]
---*/
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries();
});

View File

@ -7,6 +7,7 @@ esid: sec-object.fromentries
features: [Object.fromEntries]
---*/
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(['ab']);
});

View File

@ -8,6 +8,8 @@ esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
assert.sameValue(typeof Promise.prototype.finally, 'function');
assert.throws(TypeError, function() {
Promise.prototype.finally.call(undefined);
}, 'undefined');

View File

@ -8,6 +8,7 @@ description: >
esid: sec-promise.prototype.finally
features: [Symbol, Promise.prototype.finally]
---*/
assert.sameValue(typeof Promise.prototype.finally, 'function');
var symbol = Symbol();

View File

@ -33,6 +33,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimEnd, 'function');
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});

View File

@ -51,6 +51,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimEnd, 'function');
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});

View File

@ -52,6 +52,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimEnd, 'function');
assert.throws(TypeError, function() {
String.prototype.trimEnd.call(thisVal);
});

View File

@ -33,6 +33,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimStart, 'function');
assert.throws(TypeError, function() {
String.prototype.trimStart.call(thisVal);
});

View File

@ -51,6 +51,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimStart, 'function');
assert.throws(TypeError, function() {
String.prototype.trimStart.call(thisVal);
});

View File

@ -52,6 +52,7 @@ var thisVal = {
},
};
assert.sameValue(typeof String.prototype.trimStart, 'function');
assert.throws(TypeError, function() {
String.prototype.trimStart.call(thisVal);
});

View File

@ -12,7 +12,7 @@ info: |
are specific to TypedArray instance objects.
features: [BigInt]
---*/
assert.sameValue(typeof BigInt64Array, 'function');
assert.throws(TypeError, function () {
BigInt64Array.prototype.buffer;
});

View File

@ -12,7 +12,7 @@ info: |
are specific to TypedArray instance objects.
features: [BigInt]
---*/
assert.sameValue(typeof BigUint64Array, 'function');
assert.throws(TypeError, function () {
BigUint64Array.prototype.buffer;
});

View File

@ -12,6 +12,8 @@ info: |
features: [Intl.ListFormat]
---*/
assert.sameValue(typeof Intl.ListFormat, "function");
assert.throws(TypeError, function() {
Intl.ListFormat();
});

View File

@ -11,4 +11,7 @@ info: |
features: [Intl.ListFormat]
---*/
assert.throws(TypeError, function() { new Intl.ListFormat([], null) })
assert.sameValue(typeof Intl.ListFormat, "function");
assert.throws(TypeError, function() {
new Intl.ListFormat([], null);
});

View File

@ -12,14 +12,16 @@ info: |
features: [Intl.ListFormat]
---*/
const fn = Intl.ListFormat.prototype.format;
const format = Intl.ListFormat.prototype.format;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");
assert.sameValue(typeof format, "function");
assert.throws(TypeError, () => format.call(undefined), "undefined");
assert.throws(TypeError, () => format.call(null), "null");
assert.throws(TypeError, () => format.call(true), "true");
assert.throws(TypeError, () => format.call(""), "empty string");
assert.throws(TypeError, () => format.call(Symbol()), "symbol");
assert.throws(TypeError, () => format.call(1), "1");
assert.throws(TypeError, () => format.call({}), "plain object");
assert.throws(TypeError, () => format.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => format.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");

View File

@ -12,14 +12,15 @@ info: |
features: [Intl.ListFormat]
---*/
const fn = Intl.ListFormat.prototype.formatToParts;
const formatToParts = Intl.ListFormat.prototype.formatToParts;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");
assert.sameValue(typeof formatToParts, "function");
assert.throws(TypeError, () => formatToParts.call(undefined), "undefined");
assert.throws(TypeError, () => formatToParts.call(null), "null");
assert.throws(TypeError, () => formatToParts.call(true), "true");
assert.throws(TypeError, () => formatToParts.call(""), "empty string");
assert.throws(TypeError, () => formatToParts.call(Symbol()), "symbol");
assert.throws(TypeError, () => formatToParts.call(1), "1");
assert.throws(TypeError, () => formatToParts.call({}), "plain object");
assert.throws(TypeError, () => formatToParts.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => formatToParts.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");

View File

@ -12,14 +12,15 @@ info: |
features: [Intl.ListFormat]
---*/
const fn = Intl.ListFormat.prototype.resolvedOptions;
const resolvedOptions = Intl.ListFormat.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");
assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => resolvedOptions.call({}), "plain object");
assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");

View File

@ -13,7 +13,10 @@ info: |
features: [Intl.Locale]
---*/
const fn = Intl.Locale.prototype.maximize;
const maximize = Intl.Locale.prototype.maximize;
assert.sameValue(typeof maximize, "function");
const invalidValues = [
undefined,
null,
@ -26,5 +29,5 @@ const invalidValues = [
];
for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue));
assert.throws(TypeError, () => maximize.call(invalidValue));
}

View File

@ -13,7 +13,10 @@ info: |
features: [Intl.Locale]
---*/
const fn = Intl.Locale.prototype.minimize;
const minimize = Intl.Locale.prototype.minimize;
assert.sameValue(typeof minimize, "function");
const invalidValues = [
undefined,
null,
@ -26,5 +29,5 @@ const invalidValues = [
];
for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue));
assert.throws(TypeError, () => minimize.call(invalidValue));
}

View File

@ -13,7 +13,10 @@ info: |
features: [Intl.Locale]
---*/
const fn = Intl.Locale.prototype.toString;
const toString = Intl.Locale.prototype.toString;
assert.sameValue(typeof toString, "function");
const invalidValues = [
undefined,
null,
@ -26,5 +29,5 @@ const invalidValues = [
];
for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue));
assert.throws(TypeError, () => toString.call(invalidValue));
}

View File

@ -10,7 +10,10 @@ info: |
features: [Intl.RelativeTimeFormat]
---*/
const fn = Intl.RelativeTimeFormat.supportedLocalesOf;
const supportedLocalesOf = Intl.RelativeTimeFormat.supportedLocalesOf;
assert.sameValue(typeof supportedLocalesOf, "function");
const thisValues = [
undefined,
null,
@ -24,6 +27,6 @@ const thisValues = [
];
for (const thisValue of thisValues) {
const result = fn.call(thisValue);
const result = supportedLocalesOf.call(thisValue);
assert.sameValue(Array.isArray(result), true);
}

View File

@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat]
---*/
const fn = Intl.RelativeTimeFormat.prototype.format;
const format = Intl.RelativeTimeFormat.prototype.format;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");
assert.sameValue(typeof format, "function");
assert.throws(TypeError, () => format.call(undefined), "undefined");
assert.throws(TypeError, () => format.call(null), "null");
assert.throws(TypeError, () => format.call(true), "true");
assert.throws(TypeError, () => format.call(""), "empty string");
assert.throws(TypeError, () => format.call(Symbol()), "symbol");
assert.throws(TypeError, () => format.call(1), "1");
assert.throws(TypeError, () => format.call({}), "plain object");
assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");

View File

@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat]
---*/
const fn = Intl.RelativeTimeFormat.prototype.formatToParts;
const formatToParts = Intl.RelativeTimeFormat.prototype.formatToParts;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");
assert.sameValue(typeof formatToParts, "function");
assert.throws(TypeError, () => formatToParts.call(undefined), "undefined");
assert.throws(TypeError, () => formatToParts.call(null), "null");
assert.throws(TypeError, () => formatToParts.call(true), "true");
assert.throws(TypeError, () => formatToParts.call(""), "empty string");
assert.throws(TypeError, () => formatToParts.call(Symbol()), "symbol");
assert.throws(TypeError, () => formatToParts.call(1), "1");
assert.throws(TypeError, () => formatToParts.call({}), "plain object");
assert.throws(TypeError, () => formatToParts.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => formatToParts.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");

View File

@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat]
---*/
const fn = Intl.RelativeTimeFormat.prototype.resolvedOptions;
const resolvedOptions = Intl.RelativeTimeFormat.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");
assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => resolvedOptions.call({}), "plain object");
assert.throws(TypeError, () => resolvedOptions.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat");
assert.throws(TypeError, () => resolvedOptions.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype");

View File

@ -10,7 +10,10 @@ info: |
features: [Intl.Segmenter]
---*/
const fn = Intl.Segmenter.supportedLocalesOf;
const supportedLocalesOf = Intl.Segmenter.supportedLocalesOf;
assert.sameValue(typeof supportedLocalesOf, "function");
const thisValues = [
undefined,
null,
@ -24,6 +27,6 @@ const thisValues = [
];
for (const thisValue of thisValues) {
const result = fn.call(thisValue);
const result = supportedLocalesOf.call(thisValue);
assert.sameValue(Array.isArray(result), true);
}

View File

@ -11,14 +11,16 @@ info: |
features: [Intl.Segmenter]
---*/
const fn = Intl.Segmenter.prototype.resolvedOptions;
const resolvedOptions = Intl.Segmenter.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter");
assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");
assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => resolvedOptions.call({}), "plain object");
assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter), "Intl.Segmenter");
assert.throws(TypeError, () => resolvedOptions.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");

View File

@ -11,14 +11,16 @@ info: |
features: [Intl.Segmenter]
---*/
const fn = Intl.Segmenter.prototype.segment;
const segment = Intl.Segmenter.prototype.segment;
assert.throws(TypeError, () => fn.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true");
assert.throws(TypeError, () => fn.call(""), "empty string");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(1), "1");
assert.throws(TypeError, () => fn.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter");
assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");
assert.sameValue(typeof segment, "function");
assert.throws(TypeError, () => segment.call(undefined), "undefined");
assert.throws(TypeError, () => segment.call(null), "null");
assert.throws(TypeError, () => segment.call(true), "true");
assert.throws(TypeError, () => segment.call(""), "empty string");
assert.throws(TypeError, () => segment.call(Symbol()), "symbol");
assert.throws(TypeError, () => segment.call(1), "1");
assert.throws(TypeError, () => segment.call({}), "plain object");
assert.throws(TypeError, () => segment.call(Intl.Segmenter), "Intl.Segmenter");
assert.throws(TypeError, () => segment.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype");