Debian Codegraph @

js/src/tests/test262/intl402/Intl/getCanonicalLocales/has-property.js

raw
1 // Copyright 2016 Mozilla Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
3
4 /*---
5 esid: sec-intl.getcanonicallocales
6 description: Test Intl.getCanonicalLocales.name for step 7.b.
7 info: |
8 9.2.1 CanonicalizeLocaleList (locales)
9 7. Repeat, while k < len.
10 b. Let kPresent be HasProperty(O, Pk).
11 features: [Proxy]
12 ---*/
13
14 var locales = {
15 '0': 'en-US',
16 '1': 'pt-BR',
17 length: 2
18 };
19
20 var p = new Proxy(locales, {
21 has: function(_, prop) {
22 if (prop === '0') {
23 throw new Test262Error();
24 }
25 }
26 });
27
28 assert.throws(Test262Error, function() {
29 Intl.getCanonicalLocales(p);
30 });
31
32 reportCompare(0, 0);