summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/flags/get-order.js
blob: 4b8e8acc521b47ed49e930f2a5ecd9c345cf05f1 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2017 Aleksey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-get-regexp.prototype.flags
description: Gets are performed in specified order
info: |
  get RegExp.prototype.flags

  [...]
  4. let hasIndices be ToBoolean(? Get(R, "hasIndices"))
  6. Let global be ToBoolean(? Get(R, "global")).
  8. Let ignoreCase be ToBoolean(? Get(R, "ignoreCase")).
  10. Let multiline be ToBoolean(? Get(R, "multiline")).
  12. Let dotAll be ToBoolean(? Get(R, "dotAll")).
  14. Let unicode be ToBoolean(? Get(R, "unicode")).
  18. Let sticky be ToBoolean(? Get(R, "sticky")).
features: [regexp-dotall, regexp-match-indices]
---*/

var calls = '';
var re = {
  get hasIndices() {
    calls += 'd';
  },
  get global() {
    calls += 'g';
  },
  get ignoreCase() {
    calls += 'i';
  },
  get multiline() {
    calls += 'm';
  },
  get dotAll() {
    calls += 's';
  },
  get unicode() {
    calls += 'u';
  },
  get sticky() {
    calls += 'y';
  },
};

var get = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get;

get.call(re);
assert.sameValue(calls, 'dgimsuy');

reportCompare(0, 0);