diff --git a/harness/assert.js b/harness/assert.js index 58e98e37b720770099a90e32b39dd19eb6cf22f7..aee3b871df21e0564a3d35d4a29e0f045e4bbfce 100644 --- a/harness/assert.js +++ b/harness/assert.js @@ -27,7 +27,12 @@ assert._isSameValue = function (a, b) { }; assert.sameValue = function (actual, expected, message) { - if (assert._isSameValue(actual, expected)) { + try { + if (assert._isSameValue(actual, expected)) { + return; + } + } catch (error) { + $ERROR(message + ' (_isSameValue operation threw) ' + error); return; } diff --git a/test/intl402/Segmenter/constructor/subclass.js b/test/intl402/Segmenter/constructor/subclass.js new file mode 100644 index 0000000000000000000000000000000000000000..67282cc0288d531ec2bfac92b49d3e04698b11a1 --- /dev/null +++ b/test/intl402/Segmenter/constructor/subclass.js @@ -0,0 +1,28 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.Segmenter +description: The prototype of the Intl.Segmenter constructor is %FunctionPrototype%. +info: | + Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor. + Unless otherwise specified every built-in function object has the %FunctionPrototype% object as the initial value of its [[Prototype]] internal slot. +features: [Intl.Segmenter] +---*/ + +class CustomSegmenter extends Intl.Segmenter { + constructor(...args) { + super(...args); + this.isCustom = true; + } +} + +let cs = new CustomSegmenter(); + +assert.sameValue(Object.getPrototypeOf(CustomSegmenter), Intl.Segmenter, 'Object.getPrototypeOf(CustomSegmenter) returns the value of `Intl.Segmenter` (undefined)'); +assert.sameValue(Object.getPrototypeOf(CustomSegmenter.prototype), Intl.Segmenter.prototype, 'Object.getPrototypeOf(CustomSegmenter.prototype) returns the value of `Intl.Segmenter.prototype` (undefined)'); +assert.sameValue( + cs instanceof Intl.Segmenter, + 'CustomSegmenter instance is instanceof Intl.Segmenter', + 'The result of `(cs instanceof Intl.Segmenter)` is "CustomSegmenter instance is instanceof Intl.Segmenter"' +);