summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/String/internalUsage.js
blob: 6ee8d5a5810e73dac64f446b8e25cf5d696754f2 (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
var BUGNUMBER = 1268138;
var summary = 'Internal usage of split should not be affected by prototpe change';

print(BUGNUMBER + ": " + summary);

function test() {
  var t = 24*60*60*1000;
  var possibleAnswer = ["1.1.1970", "2.1.1970", "3.1.1970"];

  String.prototype[Symbol.split] = function(s, limit) { return [""]; };
  var s = Intl.DateTimeFormat("de", {}).format(t);
  assertEq(possibleAnswer.includes(s), true);

  String.prototype[Symbol.split] = function(s, limit) { return ["x-foo"]; };
  s = Intl.DateTimeFormat("de", {}).format(t);
  assertEq(possibleAnswer.includes(s), true);

  String.prototype[Symbol.split] = function(s, limit) { return ["de-u-co"]; };
  s = Intl.DateTimeFormat("de", {}).format(t);
  assertEq(possibleAnswer.includes(s), true);

  String.prototype[Symbol.split] = function(s, limit) { return ["en-US"]; };
  s = Intl.DateTimeFormat("de", {}).format(t);
  assertEq(possibleAnswer.includes(s), true);
}

if (this.hasOwnProperty("Intl"))
  test();

reportCompare(0, 0, "ok");