From ea4c8fc95c725922ab202af1baad5272b5bb0ca8 Mon Sep 17 00:00:00 2001 From: Valerie R Young <valerie@bocoup.com> Date: Fri, 20 Oct 2017 20:30:44 -0400 Subject: [PATCH] classfields: add tests for forbidden privatenames --- .../fields-privatename-constructor-err.js | 21 +++++++++++++++++++ .../fields-privatename-constructor-err.js | 20 ++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/language/expressions/class/fields-privatename-constructor-err.js create mode 100644 test/language/statements/class/fields-privatename-constructor-err.js diff --git a/test/language/expressions/class/fields-privatename-constructor-err.js b/test/language/expressions/class/fields-privatename-constructor-err.js new file mode 100644 index 0000000000..da6f65668a --- /dev/null +++ b/test/language/expressions/class/fields-privatename-constructor-err.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Private class fields early error with StringValue "#constructor" +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +negative: + phase: early + type: SyntaxError +info: | + ClassElementName : PrivateName; + It is a Syntax Error if StringValue of PrivateName is "#constructor". +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #constructor; +} diff --git a/test/language/statements/class/fields-privatename-constructor-err.js b/test/language/statements/class/fields-privatename-constructor-err.js new file mode 100644 index 0000000000..22946c3b4c --- /dev/null +++ b/test/language/statements/class/fields-privatename-constructor-err.js @@ -0,0 +1,20 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Private class fields early error with StringValue "#constructor" +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +negative: + phase: early + type: SyntaxError +info: | + ClassElementName : PrivateName; + It is a Syntax Error if StringValue of PrivateName is "#constructor". +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + #constructor; +} -- GitLab