Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/name.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es6id: 14.5.16
6 description: Assignment of function `name` attribute
7 info: |
8 ClassExpression : class BindingIdentifieropt ClassTail
9
10 5. If className is not undefined, then
11 a. Let hasNameProperty be HasOwnProperty(value, "name").
12 b. ReturnIfAbrupt(hasNameProperty).
13 c. If hasNameProperty is false, then
14 i. Perform SetFunctionName(value, className).
15 includes: [propertyHelper.js]
16 ---*/
17
18 assert.sameValue(Object.hasOwnProperty.call(class {}, 'name'), false);
19
20 assert.sameValue(class cls {}.name, 'cls');
21 verifyNotEnumerable(class cls {}, 'name');
22 verifyNotWritable(class cls {}, 'name');
23 verifyConfigurable(class cls {}, 'name');
24
25 assert.sameValue(
26 Object.hasOwnProperty.call(class { constructor() {} }, 'name'), false
27 );
28
29 assert.sameValue(class cls { constructor() {} }.name, 'cls');
30 verifyNotEnumerable(class cls { constructor() {} }, 'name');
31 verifyNotWritable(class cls { constructor() {} }, 'name');
32 verifyConfigurable(class cls { constructor() {} }, 'name');