Skip to content
Snippets Groups Projects
Unverified Commit 31e654a3 authored by Leo Balter's avatar Leo Balter Committed by GitHub
Browse files

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

Eliminate some false positives
parents 476e6877 3b09d0e2
No related branches found
No related tags found
No related merge requests found
Showing
with 96 additions and 70 deletions
...@@ -12,14 +12,15 @@ info: | ...@@ -12,14 +12,15 @@ info: |
features: [Intl.ListFormat] features: [Intl.ListFormat]
---*/ ---*/
const fn = Intl.ListFormat.prototype.resolvedOptions; const resolvedOptions = Intl.ListFormat.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => fn.call(null), "null"); assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.ListFormat), "Intl.ListFormat"); assert.throws(TypeError, () => resolvedOptions.call({}), "plain object");
assert.throws(TypeError, () => fn.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype"); assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat), "Intl.ListFormat");
assert.throws(TypeError, () => resolvedOptions.call(Intl.ListFormat.prototype), "Intl.ListFormat.prototype");
...@@ -13,7 +13,10 @@ info: | ...@@ -13,7 +13,10 @@ info: |
features: [Intl.Locale] features: [Intl.Locale]
---*/ ---*/
const fn = Intl.Locale.prototype.maximize; const maximize = Intl.Locale.prototype.maximize;
assert.sameValue(typeof maximize, "function");
const invalidValues = [ const invalidValues = [
undefined, undefined,
null, null,
...@@ -26,5 +29,5 @@ const invalidValues = [ ...@@ -26,5 +29,5 @@ const invalidValues = [
]; ];
for (const invalidValue of invalidValues) { for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue)); assert.throws(TypeError, () => maximize.call(invalidValue));
} }
...@@ -13,7 +13,10 @@ info: | ...@@ -13,7 +13,10 @@ info: |
features: [Intl.Locale] features: [Intl.Locale]
---*/ ---*/
const fn = Intl.Locale.prototype.minimize; const minimize = Intl.Locale.prototype.minimize;
assert.sameValue(typeof minimize, "function");
const invalidValues = [ const invalidValues = [
undefined, undefined,
null, null,
...@@ -26,5 +29,5 @@ const invalidValues = [ ...@@ -26,5 +29,5 @@ const invalidValues = [
]; ];
for (const invalidValue of invalidValues) { for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue)); assert.throws(TypeError, () => minimize.call(invalidValue));
} }
...@@ -13,7 +13,10 @@ info: | ...@@ -13,7 +13,10 @@ info: |
features: [Intl.Locale] features: [Intl.Locale]
---*/ ---*/
const fn = Intl.Locale.prototype.toString; const toString = Intl.Locale.prototype.toString;
assert.sameValue(typeof toString, "function");
const invalidValues = [ const invalidValues = [
undefined, undefined,
null, null,
...@@ -26,5 +29,5 @@ const invalidValues = [ ...@@ -26,5 +29,5 @@ const invalidValues = [
]; ];
for (const invalidValue of invalidValues) { for (const invalidValue of invalidValues) {
assert.throws(TypeError, () => fn.call(invalidValue)); assert.throws(TypeError, () => toString.call(invalidValue));
} }
...@@ -10,7 +10,10 @@ info: | ...@@ -10,7 +10,10 @@ info: |
features: [Intl.RelativeTimeFormat] features: [Intl.RelativeTimeFormat]
---*/ ---*/
const fn = Intl.RelativeTimeFormat.supportedLocalesOf; const supportedLocalesOf = Intl.RelativeTimeFormat.supportedLocalesOf;
assert.sameValue(typeof supportedLocalesOf, "function");
const thisValues = [ const thisValues = [
undefined, undefined,
null, null,
...@@ -24,6 +27,6 @@ const thisValues = [ ...@@ -24,6 +27,6 @@ const thisValues = [
]; ];
for (const thisValue of thisValues) { for (const thisValue of thisValues) {
const result = fn.call(thisValue); const result = supportedLocalesOf.call(thisValue);
assert.sameValue(Array.isArray(result), true); assert.sameValue(Array.isArray(result), true);
} }
...@@ -11,14 +11,16 @@ info: | ...@@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat] features: [Intl.RelativeTimeFormat]
---*/ ---*/
const fn = Intl.RelativeTimeFormat.prototype.format; const format = Intl.RelativeTimeFormat.prototype.format;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof format, "function");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => format.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => format.call(null), "null");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => format.call(true), "true");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => format.call(""), "empty string");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => format.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); assert.throws(TypeError, () => format.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); 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");
...@@ -11,14 +11,16 @@ info: | ...@@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat] features: [Intl.RelativeTimeFormat]
---*/ ---*/
const fn = Intl.RelativeTimeFormat.prototype.formatToParts; const formatToParts = Intl.RelativeTimeFormat.prototype.formatToParts;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof formatToParts, "function");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => formatToParts.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => formatToParts.call(null), "null");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => formatToParts.call(true), "true");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => formatToParts.call(""), "empty string");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => formatToParts.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); assert.throws(TypeError, () => formatToParts.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); 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");
...@@ -11,14 +11,16 @@ info: | ...@@ -11,14 +11,16 @@ info: |
features: [Intl.RelativeTimeFormat] features: [Intl.RelativeTimeFormat]
---*/ ---*/
const fn = Intl.RelativeTimeFormat.prototype.resolvedOptions; const resolvedOptions = Intl.RelativeTimeFormat.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); 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");
...@@ -10,7 +10,10 @@ info: | ...@@ -10,7 +10,10 @@ info: |
features: [Intl.Segmenter] features: [Intl.Segmenter]
---*/ ---*/
const fn = Intl.Segmenter.supportedLocalesOf; const supportedLocalesOf = Intl.Segmenter.supportedLocalesOf;
assert.sameValue(typeof supportedLocalesOf, "function");
const thisValues = [ const thisValues = [
undefined, undefined,
null, null,
...@@ -24,6 +27,6 @@ const thisValues = [ ...@@ -24,6 +27,6 @@ const thisValues = [
]; ];
for (const thisValue of thisValues) { for (const thisValue of thisValues) {
const result = fn.call(thisValue); const result = supportedLocalesOf.call(thisValue);
assert.sameValue(Array.isArray(result), true); assert.sameValue(Array.isArray(result), true);
} }
...@@ -11,14 +11,16 @@ info: | ...@@ -11,14 +11,16 @@ info: |
features: [Intl.Segmenter] features: [Intl.Segmenter]
---*/ ---*/
const fn = Intl.Segmenter.prototype.resolvedOptions; const resolvedOptions = Intl.Segmenter.prototype.resolvedOptions;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof resolvedOptions, "function");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => resolvedOptions.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => resolvedOptions.call(null), "null");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => resolvedOptions.call(true), "true");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => resolvedOptions.call(""), "empty string");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => resolvedOptions.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter"); assert.throws(TypeError, () => resolvedOptions.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); 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");
...@@ -11,14 +11,16 @@ info: | ...@@ -11,14 +11,16 @@ info: |
features: [Intl.Segmenter] features: [Intl.Segmenter]
---*/ ---*/
const fn = Intl.Segmenter.prototype.segment; const segment = Intl.Segmenter.prototype.segment;
assert.throws(TypeError, () => fn.call(undefined), "undefined"); assert.sameValue(typeof segment, "function");
assert.throws(TypeError, () => fn.call(null), "null");
assert.throws(TypeError, () => fn.call(true), "true"); assert.throws(TypeError, () => segment.call(undefined), "undefined");
assert.throws(TypeError, () => fn.call(""), "empty string"); assert.throws(TypeError, () => segment.call(null), "null");
assert.throws(TypeError, () => fn.call(Symbol()), "symbol"); assert.throws(TypeError, () => segment.call(true), "true");
assert.throws(TypeError, () => fn.call(1), "1"); assert.throws(TypeError, () => segment.call(""), "empty string");
assert.throws(TypeError, () => fn.call({}), "plain object"); assert.throws(TypeError, () => segment.call(Symbol()), "symbol");
assert.throws(TypeError, () => fn.call(Intl.Segmenter), "Intl.Segmenter"); assert.throws(TypeError, () => segment.call(1), "1");
assert.throws(TypeError, () => fn.call(Intl.Segmenter.prototype), "Intl.Segmenter.prototype"); 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");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment