summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/prototype/toLocaleString/primitive_this_value_getter-strict.js
blob: 1dd5009ef5b2fa3bb0103a2710ce775ebbb9f025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-array.prototype.tolocalestring
description: Array.prototype.toLocaleString called with primitive element in getter
info: |
  22.1.3.26 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )

  ...
  10. Else
    a. Let R be ToString(Invoke(firstElement, "toLocaleString")).
    b. ReturnIfAbrupt(R).
  ...
  12.
    ...
    e. Else
      i.  Let R be ToString(Invoke(nextElement, "toLocaleString")).
      ii. ReturnIfAbrupt(R).
es6id: 22.1.3.26
flags: [onlyStrict]
---*/

var listSeparator = ["", ""].toLocaleString();

Object.defineProperty(Boolean.prototype, "toString", {
  get: function() {
    var v = typeof this;
    return function() {
      return v;
    };
  }
});

assert.sameValue([true, false].toLocaleString(), ("boolean" + listSeparator + "boolean"));

reportCompare(0, 0);