Intl.Segmenter: Some initial tests. (#1844)

This commit is contained in:
Ms2ger 2018-10-15 17:29:25 +02:00 committed by Leo Balter
parent f6dcb4fc2b
commit e527498bff
26 changed files with 655 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// 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: >
Checks the "length" property of the Segmenter constructor.
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.
The Segmenter constructor is a standard built-in property of the Intl object.
Every built-in function object, including constructors, has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form «...name») are not included in the default argument count.
Unless otherwise specified, the length property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,20 @@
// 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: Checks the "name" property of the Segmenter constructor.
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.
Every built-in function object, including constructors, that is not identified as an anonymous function has a name property whose value is a String. Unless otherwise specified, this value is the name that is given to the function in this specification.
Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter, "name", {
value: "Segmenter",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -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.Segmenter
description: Verifies the "Segmenter" property of Intl.
info: |
Requirements for Standard Built-in ECMAScript Objects
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 2018 Language
Specification, 9th edition, clause 17, or successor.
ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2 has the
attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
unless otherwise specified.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter, "function");
verifyProperty(Intl, "Segmenter", {
value: Intl.Segmenter,
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,17 @@
// 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]
---*/
assert.sameValue(
Object.getPrototypeOf(Intl.Segmenter),
Function.prototype,
"Object.getPrototypeOf(Intl.Segmenter) equals the value of Function.prototype"
);

View File

@ -0,0 +1,19 @@
// 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.supportedLocalesOf
description: Tests that Intl.Segmenter has a supportedLocalesOf property, and it works as expected.
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"supportedLocalesOf should be supported.");
const defaultLocale = new Intl.Segmenter().resolvedOptions().locale;
const notSupported = "zxx"; // "no linguistic content"
const requestedLocales = [defaultLocale, notSupported];
const supportedLocales = Intl.Segmenter.supportedLocalesOf(requestedLocales);
assert.sameValue(supportedLocales.length, 1, "The length of supported locales list is not 1.");
assert.sameValue(supportedLocales[0], defaultLocale, "The default locale is not returned in the supported list.");

View File

@ -0,0 +1,29 @@
// 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.supportedLocalesOf
description: >
Verifies there's no branding check for Intl.Segmenter.supportedLocalesOf().
info: |
Intl.Segmenter.supportedLocalesOf ( locales [, options ])
features: [Intl.Segmenter]
---*/
const fn = Intl.Segmenter.supportedLocalesOf;
const thisValues = [
undefined,
null,
true,
"",
Symbol(),
1,
{},
Intl.Segmenter,
Intl.Segmenter.prototype,
];
for (const thisValue of thisValues) {
const result = fn.call(thisValue);
assert.sameValue(Array.isArray(result), true);
}

View File

@ -0,0 +1,22 @@
// 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.supportedLocalesOf
description: >
Checks the "length" property of Intl.Segmenter.supportedLocalesOf().
info: |
The value of the length property of the supportedLocalesOf method is 1.
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.
Every built-in function object, including constructors, has a length property whose value is an integer.
Unless otherwise specified, the length property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter.supportedLocalesOf, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,20 @@
// 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.supportedLocalesOf
description: Checks error cases for the locales argument to the supportedLocalesOf function.
info: |
Intl.Segmenter.supportedLocalesOf ( locales [, options ])
2. Let requestedLocales be CanonicalizeLocaleList(locales).
includes: [testIntl.js]
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"Should support Intl.Segmenter.supportedLocalesOf.");
for (const [locales, expectedError] of getInvalidLocaleArguments()) {
assert.throws(expectedError, () => Intl.Segmenter.supportedLocalesOf(locales));
}

View File

@ -0,0 +1,21 @@
// 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.supportedLocalesOf
description: >
Checks the "name" property of Intl.Segmenter.supportedLocalesOf().
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.
Every built-in function object, including constructors, that is not identified as an anonymous function has a name property whose value is a String. Unless otherwise specified, this value is the name that is given to the function in this specification.
Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter.supportedLocalesOf, "name", {
value: "supportedLocalesOf",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,34 @@
// 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.supportedLocalesOf
description: Checks handling of invalid values for the localeMatcher option to the supportedLocalesOf function.
info: |
SupportedLocales ( availableLocales, requestedLocales, options )
1. If options is not undefined, then
b. Let matcher be ? GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit").
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"Should support Intl.Segmenter.supportedLocalesOf.");
const invalidOptions = [
null,
1,
"",
"Lookup",
"LOOKUP",
"lookup\0",
"Best fit",
"BEST FIT",
"best\u00a0fit",
];
for (const invalidOption of invalidOptions) {
assert.throws(RangeError, function() {
Intl.Segmenter.supportedLocalesOf([], {"localeMatcher": invalidOption});
}, `${invalidOption} is an invalid localeMatcher option value`);
}

View File

@ -0,0 +1,20 @@
// 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.supportedLocalesOf
description: Checks handling of a null options argument to the supportedLocalesOf function.
info: |
SupportedLocales ( availableLocales, requestedLocales, options )
1. If options is not undefined, then
a. Let options be ? ToObject(options).
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"Should support Intl.Segmenter.supportedLocalesOf.");
assert.throws(TypeError, function() {
Intl.Segmenter.supportedLocalesOf([], null);
}, "Should throw when passing null as the options argument");

View File

@ -0,0 +1,41 @@
// 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.supportedLocalesOf
description: Checks handling of non-object options arguments to the supportedLocalesOf function.
info: |
SupportedLocales ( availableLocales, requestedLocales, options )
1. If options is not undefined, then
a. Let options be ? ToObject(options).
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"Should support Intl.Segmenter.supportedLocalesOf.");
let called;
Object.defineProperties(Object.prototype, {
"localeMatcher": {
get() {
++called;
return "best fit";
}
}
});
const optionsArguments = [
true,
"test",
7,
Symbol(),
];
for (const options of optionsArguments) {
called = 0;
const result = Intl.Segmenter.supportedLocalesOf([], options);
assert.sameValue(Array.isArray(result), true, `Expected array from ${String(options)}`);
assert.sameValue(called, 1, `Expected one call from ${String(options)}`);
}

View File

@ -0,0 +1,26 @@
// 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.supportedLocalesOf
description: Checks handling of an undefined options argument to the supportedLocalesOf function.
info: |
SupportedLocales ( availableLocales, requestedLocales, options )
1. If options is not undefined, then
b. Let matcher be ? GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit").
features: [Intl.Segmenter]
---*/
assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
"Should support Intl.Segmenter.supportedLocalesOf.");
Object.defineProperties(Object.prototype, {
"localeMatcher": {
get() { throw new Error("Should not call localeMatcher getter"); }
}
});
assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf()), true, "No arguments");
assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf([])), true, "One argument");
assert.sameValue(Array.isArray(Intl.Segmenter.supportedLocalesOf([], undefined)), true, "Two arguments");

View File

@ -0,0 +1,29 @@
// 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.supportedLocalesOf
description: >
Checks the "supportedLocalesOf" property of the Segmenter prototype object.
info: |
Intl.Segmenter.supportedLocalesOf ( locales [, options ])
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.
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
assert.sameValue(
typeof Intl.Segmenter.supportedLocalesOf,
"function",
"typeof Intl.Segmenter.supportedLocalesOf is function"
);
verifyProperty(Intl.Segmenter, "supportedLocalesOf", {
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,34 @@
// 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.supportedLocalesOf
description: Verifies the type of the return value of Intl.Segmenter.supportedLocalesOf().
info: |
Intl.Segmenter.supportedLocalesOf ( locales [, options ])
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
const result = Intl.Segmenter.supportedLocalesOf("en");
assert.sameValue(Array.isArray(result), true,
"Array.isArray() should return true");
assert.sameValue(Object.getPrototypeOf(result), Array.prototype,
"The prototype should be Array.prototype");
assert.sameValue(Object.isExtensible(result), true,
"Object.isExtensible() should return true");
assert.notSameValue(result.length, 0);
for (let i = 0; i < result.length; ++i) {
verifyProperty(result, String(i), {
"writable": false,
"enumerable": true,
"configurable": false,
});
}
verifyProperty(result, "length", {
"writable": false,
"enumerable": false,
"configurable": false,
});

View File

@ -0,0 +1,19 @@
// 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: Intl.Segmenter instance object extensibility
info: |
17 ECMAScript Standard Built-in Objects:
Unless specified otherwise, the [[Extensible]] internal slot
of a built-in object initially has the value true.
features: [Intl.Segmenter]
---*/
assert.sameValue(
Object.isExtensible(new Intl.Segmenter()),
true,
"Object.isExtensible(new Intl.Segmenter()) returns true"
);

View File

@ -0,0 +1,19 @@
// 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: Intl.Segmenter instance object is created from %SegmenterPrototype%.
info: |
Intl.Segmenter ([ locales [ , options ]])
2. Let segmenter be ? OrdinaryCreateFromConstructor(NewTarget, "%SegmenterPrototype%", « [[InitializedSegmenter]] »).
features: [Intl.Segmenter]
---*/
const value = new Intl.Segmenter();
assert.sameValue(
Object.getPrototypeOf(value),
Intl.Segmenter.prototype,
"Object.getPrototypeOf(value) equals the value of Intl.Segmenter.prototype"
);

View File

@ -0,0 +1,24 @@
// 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.prototype.constructor
description: Checks the "constructor" property of the Segmenter prototype object.
info: |
Intl.Segmenter.prototype.constructor
The initial value of Intl.Segmenter.prototype.constructor is %Segmenter%.
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.
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter.prototype, "constructor", {
value: Intl.Segmenter,
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,21 @@
// 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.prototype
description: Checks the "prototype" property of the Segmenter constructor.
info: |
Intl.Segmenter.prototype
The value of Intl.Segmenter.prototype is %SegmenterPrototype%.
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter, "prototype", {
writable: false,
enumerable: false,
configurable: false,
});

View File

@ -0,0 +1,24 @@
// 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.prototype.resolvedOptions
description: Verifies the branding check for the "resolvedOptions" function of the Segmenter prototype object.
info: |
Intl.Segmenter.prototype.resolvedOptions ()
2. If Type(pr) is not Object or pr does not have an [[InitializedSegmenter]] internal slot, throw a TypeError exception.
features: [Intl.Segmenter]
---*/
const fn = 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");

View File

@ -0,0 +1,17 @@
// 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.prototype.resolvedOptions
description: Verifies that the return value of Intl.Segmenter.prototype.resolvedOptions() is not cached.
info: |
Intl.Segmenter.prototype.resolvedOptions ()
3. Let options be ! ObjectCreate(%ObjectPrototype%).
features: [Intl.Segmenter]
---*/
const s = new Intl.Segmenter("en-us");
const options1 = s.resolvedOptions();
const options2 = s.resolvedOptions();
assert.notSameValue(options1, options2, "Should create a new object each time.");

View File

@ -0,0 +1,21 @@
// 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.prototype.resolvedOptions
description: Checks the "length" property of Intl.Segmenter.prototype.resolvedOptions().
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.
The Segmenter constructor is a standard built-in property of the Intl object.
Every built-in function object, including constructors, has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form «...name») are not included in the default argument count.
Unless otherwise specified, the length property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter.prototype.resolvedOptions, "length", {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,20 @@
// 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.prototype.resolvedOptions
description: Checks the "name" property of Intl.Segmenter.prototype.resolvedOptions().
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.
Every built-in function object, including constructors, that is not identified as an anonymous function has a name property whose value is a String. Unless otherwise specified, this value is the name that is given to the function in this specification.
Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
verifyProperty(Intl.Segmenter.prototype.resolvedOptions, "name", {
value: "resolvedOptions",
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,27 @@
// 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.prototype.resolvedOptions
description: Checks the "resolvedOptions" property of the Segmenter prototype object.
info: |
Intl.Segmenter.prototype.resolvedOptions ()
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.
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
assert.sameValue(
typeof Intl.Segmenter.prototype.resolvedOptions,
"function",
"typeof Intl.Segmenter.prototype.resolvedOptions is function"
);
verifyProperty(Intl.Segmenter.prototype, "resolvedOptions", {
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,41 @@
// 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.prototype.resolvedOptions
description: Checks the properties of the result of Intl.Segmenter.prototype.resolvedOptions().
info: |
Intl.Segmenter.prototype.resolvedOptions ()
3. Let options be ! ObjectCreate(%ObjectPrototype%).
4. For each row of Table 1, except the header row, do
c. If v is not undefined, then
i. Perform ! CreateDataPropertyOrThrow(options, p, v).
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
const rtf = new Intl.Segmenter("en-us", { "lineBreakStyle": "loose", "granularity": "line" });
const options = rtf.resolvedOptions();
assert.sameValue(Object.getPrototypeOf(options), Object.prototype, "Prototype");
verifyProperty(options, "locale", {
value: "en-US",
writable: true,
enumerable: true,
configurable: true,
});
verifyProperty(options, "granularity", {
value: "line",
writable: true,
enumerable: true,
configurable: true,
});
verifyProperty(options, "lineBreakStyle", {
value: "loose",
writable: true,
enumerable: true,
configurable: true,
});

View File

@ -0,0 +1,36 @@
// 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.prototype.resolvedOptions
description: Checks the properties of the result of Intl.Segmenter.prototype.resolvedOptions().
info: |
Intl.Segmenter.prototype.resolvedOptions ()
3. Let options be ! ObjectCreate(%ObjectPrototype%).
4. For each row of Table 1, except the header row, do
c. If v is not undefined, then
i. Perform ! CreateDataPropertyOrThrow(options, p, v).
includes: [propertyHelper.js]
features: [Intl.Segmenter]
---*/
const rtf = new Intl.Segmenter("en-us", { "lineBreakStyle": "loose", "granularity": "word" });
const options = rtf.resolvedOptions();
assert.sameValue(Object.getPrototypeOf(options), Object.prototype, "Prototype");
verifyProperty(options, "locale", {
value: "en-US",
writable: true,
enumerable: true,
configurable: true,
});
verifyProperty(options, "granularity", {
value: "word",
writable: true,
enumerable: true,
configurable: true,
});
verifyProperty(options, "lineBreakStyle", undefined);