diff options
Diffstat (limited to 'js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js')
-rw-r--r-- | js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js b/js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js new file mode 100644 index 0000000000..db621a80c6 --- /dev/null +++ b/js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js @@ -0,0 +1,44 @@ +// |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally +// 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)}`); +} + + +reportCompare(0, 0); |