From 326fe2b8ac201ea0baef81e17998b7a20cf25278 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 4 Jun 2018 17:38:23 +0200 Subject: [PATCH] Add tests for branding checks in Intl.Locale.prototype members. --- .../Locale/prototype/baseName/branding.js | 30 +++++++++++++++++ .../Locale/prototype/calendar/branding.js | 30 +++++++++++++++++ .../Locale/prototype/caseFirst/branding.js | 32 +++++++++++++++++++ .../Locale/prototype/collation/branding.js | 30 +++++++++++++++++ .../Locale/prototype/hourCycle/branding.js | 30 +++++++++++++++++ .../Locale/prototype/language/branding.js | 30 +++++++++++++++++ .../Locale/prototype/maximize/branding.js | 30 +++++++++++++++++ .../Locale/prototype/minimize/branding.js | 30 +++++++++++++++++ .../prototype/numberingSystem/branding.js | 30 +++++++++++++++++ .../Locale/prototype/numeric/branding.js | 32 +++++++++++++++++++ .../Locale/prototype/region/branding.js | 30 +++++++++++++++++ .../Locale/prototype/script/branding.js | 30 +++++++++++++++++ .../Locale/prototype/toString/branding.js | 30 +++++++++++++++++ 13 files changed, 394 insertions(+) create mode 100644 test/intl402/Locale/prototype/baseName/branding.js create mode 100644 test/intl402/Locale/prototype/calendar/branding.js create mode 100644 test/intl402/Locale/prototype/caseFirst/branding.js create mode 100644 test/intl402/Locale/prototype/collation/branding.js create mode 100644 test/intl402/Locale/prototype/hourCycle/branding.js create mode 100644 test/intl402/Locale/prototype/language/branding.js create mode 100644 test/intl402/Locale/prototype/maximize/branding.js create mode 100644 test/intl402/Locale/prototype/minimize/branding.js create mode 100644 test/intl402/Locale/prototype/numberingSystem/branding.js create mode 100644 test/intl402/Locale/prototype/numeric/branding.js create mode 100644 test/intl402/Locale/prototype/region/branding.js create mode 100644 test/intl402/Locale/prototype/script/branding.js create mode 100644 test/intl402/Locale/prototype/toString/branding.js diff --git a/test/intl402/Locale/prototype/baseName/branding.js b/test/intl402/Locale/prototype/baseName/branding.js new file mode 100644 index 0000000000..dc464a228f --- /dev/null +++ b/test/intl402/Locale/prototype/baseName/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.baseName +description: > + Verifies the branding check for the "baseName" property of the Locale prototype object. +info: | + Intl.Locale.prototype.baseName + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "baseName"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/calendar/branding.js b/test/intl402/Locale/prototype/calendar/branding.js new file mode 100644 index 0000000000..ee26b0bfdc --- /dev/null +++ b/test/intl402/Locale/prototype/calendar/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.calendar +description: > + Verifies the branding check for the "calendar" property of the Locale prototype object. +info: | + Intl.Locale.prototype.calendar + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "calendar"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/caseFirst/branding.js b/test/intl402/Locale/prototype/caseFirst/branding.js new file mode 100644 index 0000000000..52f8cf651b --- /dev/null +++ b/test/intl402/Locale/prototype/caseFirst/branding.js @@ -0,0 +1,32 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.caseFirst +description: > + Verifies the branding check for the "caseFirst" property of the Locale prototype object. +info: | + Intl.Locale.prototype.caseFirst + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "caseFirst"); +if (propdesc !== undefined) { + const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, + ]; + + for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); + } +} diff --git a/test/intl402/Locale/prototype/collation/branding.js b/test/intl402/Locale/prototype/collation/branding.js new file mode 100644 index 0000000000..b9cabcc028 --- /dev/null +++ b/test/intl402/Locale/prototype/collation/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.collation +description: > + Verifies the branding check for the "collation" property of the Locale prototype object. +info: | + Intl.Locale.prototype.collation + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "collation"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/hourCycle/branding.js b/test/intl402/Locale/prototype/hourCycle/branding.js new file mode 100644 index 0000000000..b159d30c5c --- /dev/null +++ b/test/intl402/Locale/prototype/hourCycle/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.hourCycle +description: > + Verifies the branding check for the "hourCycle" property of the Locale prototype object. +info: | + Intl.Locale.prototype.hourCycle + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "hourCycle"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/language/branding.js b/test/intl402/Locale/prototype/language/branding.js new file mode 100644 index 0000000000..47589a9aa1 --- /dev/null +++ b/test/intl402/Locale/prototype/language/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.language +description: > + Verifies the branding check for the "language" property of the Locale prototype object. +info: | + Intl.Locale.prototype.language + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "language"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/maximize/branding.js b/test/intl402/Locale/prototype/maximize/branding.js new file mode 100644 index 0000000000..83c6e28c31 --- /dev/null +++ b/test/intl402/Locale/prototype/maximize/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.maximize +description: > + Verifies the branding check for the "maximize" function of the Locale prototype object. +info: | + Intl.Locale.prototype.maximize + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const fn = Intl.Locale.prototype.maximize; +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => fn.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/minimize/branding.js b/test/intl402/Locale/prototype/minimize/branding.js new file mode 100644 index 0000000000..41f42e692a --- /dev/null +++ b/test/intl402/Locale/prototype/minimize/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.minimize +description: > + Verifies the branding check for the "minimize" function of the Locale prototype object. +info: | + Intl.Locale.prototype.minimize + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const fn = Intl.Locale.prototype.minimize; +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => fn.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/numberingSystem/branding.js b/test/intl402/Locale/prototype/numberingSystem/branding.js new file mode 100644 index 0000000000..9d07a48138 --- /dev/null +++ b/test/intl402/Locale/prototype/numberingSystem/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.numberingSystem +description: > + Verifies the branding check for the "numberingSystem" property of the Locale prototype object. +info: | + Intl.Locale.prototype.numberingSystem + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numberingSystem"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/numeric/branding.js b/test/intl402/Locale/prototype/numeric/branding.js new file mode 100644 index 0000000000..eb5e2f0cd6 --- /dev/null +++ b/test/intl402/Locale/prototype/numeric/branding.js @@ -0,0 +1,32 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.numeric +description: > + Verifies the branding check for the "numeric" property of the Locale prototype object. +info: | + Intl.Locale.prototype.numeric + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "numeric"); +if (propdesc !== undefined) { + const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, + ]; + + for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); + } +} diff --git a/test/intl402/Locale/prototype/region/branding.js b/test/intl402/Locale/prototype/region/branding.js new file mode 100644 index 0000000000..90350560f0 --- /dev/null +++ b/test/intl402/Locale/prototype/region/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.region +description: > + Verifies the branding check for the "region" property of the Locale prototype object. +info: | + Intl.Locale.prototype.region + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "region"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/script/branding.js b/test/intl402/Locale/prototype/script/branding.js new file mode 100644 index 0000000000..d74f2e11ab --- /dev/null +++ b/test/intl402/Locale/prototype/script/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.script +description: > + Verifies the branding check for the "script" property of the Locale prototype object. +info: | + Intl.Locale.prototype.script + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "script"); +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => propdesc.get.call(invalidValue)); +} diff --git a/test/intl402/Locale/prototype/toString/branding.js b/test/intl402/Locale/prototype/toString/branding.js new file mode 100644 index 0000000000..25d85a5758 --- /dev/null +++ b/test/intl402/Locale/prototype/toString/branding.js @@ -0,0 +1,30 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Locale.prototype.toString +description: > + Verifies the branding check for the "toString" function of the Locale prototype object. +info: | + Intl.Locale.prototype.toString + + 2. If Type(loc) is not Object or loc does not have an [[InitializedLocale]] internal slot, then + a. Throw a TypeError exception. +features: [Intl.Locale] +---*/ + +const fn = Intl.Locale.prototype.toString; +const invalidValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + Intl.Locale.prototype, +]; + +for (const invalidValue of invalidValues) { + assert.throws(TypeError, () => fn.call(invalidValue)); +}