Skip to content
Snippets Groups Projects
Commit 3efcde4b authored by André Bargull's avatar André Bargull Committed by Leo Balter
Browse files

Add tests for setting class-name in ClassDefinitionEvaluation (#2057)

Spec PR: tc39/ecma262#1372
parent fb9bb750
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,6 @@ assert(
"`compareArray(Object.keys(C), [])` returns `true`"
);
assert(
compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name']),
"`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'a', 'c', 'name'])` returns `true`"
compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'name', 'a', 'c']),
"`compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'prototype', 'name', 'a', 'c'])` returns `true`"
);
......@@ -21,6 +21,6 @@ assert(
"`compareArray(Object.keys(C), [])` returns `true`"
);
assert(
compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name']),
"`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'b', 'c', 'd', 'name'])` returns `true`"
compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'b', 'c', 'd']),
"`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'b', 'c', 'd'])` returns `true`"
);
......@@ -24,8 +24,8 @@ assert(
"`compareArray(Object.keys(C), [])` returns `true`"
);
assert(
compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name']),
"`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'a', 'c', 'name'])` returns `true`"
compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'c']),
"`compareArray(Object.getOwnPropertyNames(C), ['length', 'prototype', 'name', 'a', 'c'])` returns `true`"
);
assert(
compareArray(Object.getOwnPropertySymbols(C), [sym1, sym2]),
......
// Copyright 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
The inferred class-name is present when executing static field initializers of anonymous class expressions.
info: |
14.6.13 Runtime Semantics: ClassDefinitionEvaluation
[...]
17. Perform MakeClassConstructor(F).
18. If className is not undefined, then
a. Perform SetFunctionName(F, className).
[...]
features: [class-static-fields-public]
---*/
var className;
var C = class {
static f = (className = this.name);
}
assert.sameValue(className, "C");
// Copyright 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
The class-name is present when executing static field initializers of class declarations.
info: |
14.6.13 Runtime Semantics: ClassDefinitionEvaluation
[...]
17. Perform MakeClassConstructor(F).
18. If className is not undefined, then
a. Perform SetFunctionName(F, className).
[...]
features: [class-static-fields-public]
---*/
var className;
class C {
static f = (className = this.name);
}
assert.sameValue(className, "C");
// Copyright 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
The class-name is present when executing static field initializers of default-exported classes.
info: |
14.6.13 Runtime Semantics: ClassDefinitionEvaluation
[...]
17. Perform MakeClassConstructor(F).
18. If className is not undefined, then
a. Perform SetFunctionName(F, className).
[...]
flags: [module]
features: [class-static-fields-public]
---*/
var className;
export default class {
static f = (className = this.name);
}
assert.sameValue(className, "default");
// Copyright 2019 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
The class-name is present when executing static field initializers of named class expressions.
info: |
14.6.13 Runtime Semantics: ClassDefinitionEvaluation
[...]
17. Perform MakeClassConstructor(F).
18. If className is not undefined, then
a. Perform SetFunctionName(F, className).
[...]
features: [class-static-fields-public]
---*/
var className;
var expr = class C {
static f = (className = this.name);
}
assert.sameValue(className, "C");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment