summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/reserved-words/ident-name-keyword-prop-name.js
blob: d4a4487340f61b24a8e5ca20379f7419e641a269 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (c) 2012 Ecma International.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 7.6.1-1-2
description: >
    Allow reserved words as property names at object initialization.
---*/

var tokenCodes = {
    await: 'await',
    break: 'break',
    case: 'case',
    catch: 'catch',
    class: 'class',
    const: 'const',
    continue: 'continue',
    debugger: 'debugger',
    default: 'default',
    delete: 'delete',
    do: 'do',
    else: 'else',
    export: 'export',
    extends: 'extends',
    finally: 'finally',
    for: 'for',
    function: 'function',
    if: 'if',
    import: 'import',
    in: 'in',
    instanceof: 'instanceof',
    new: 'new',
    return: 'return',
    super: 'super',
    switch: 'switch',
    this: 'this',
    throw: 'throw',
    try: 'try',
    typeof: 'typeof',
    var: 'var',
    void: 'void',
    while: 'while',
    with: 'with',
    yield: 'yield',

    enum: 'enum',

    implements: 'implements',
    interface: 'interface',
    package: 'package',
    protected: 'protected',
    private: 'private',
    public: 'public',

    let: 'let',
    static: 'static',
};

var arr = [
    'await',
    'break',
    'case',
    'catch',
    'class',
    'const',
    'continue',
    'debugger',
    'default',
    'delete',
    'do',
    'else',
    'export',
    'extends',
    'finally',
    'for',
    'function',
    'if',
    'import',
    'in',
    'instanceof',
    'new',
    'return',
    'super',
    'switch',
    'this',
    'throw',
    'try',
    'typeof',
    'var',
    'void',
    'while',
    'with',
    'yield',

    'enum',

    'implements',
    'interface',
    'package',
    'protected',
    'private',
    'public',

    'let',
    'static',
];

for (var i = 0; i < arr.length; ++i) {
    var propertyName = arr[i];

    assert(tokenCodes.hasOwnProperty(propertyName),
           'Property "' + propertyName + '" found');

    assert.sameValue(tokenCodes[propertyName], propertyName,
                     'Property "' + propertyName + '" has correct value');
}

reportCompare(0, 0);