From c39eeb9276f657e43d1898b7837dbf01b0f0b180 Mon Sep 17 00:00:00 2001 From: Valerie R Young Date: Fri, 20 Oct 2017 21:16:42 -0400 Subject: [PATCH] classfields: add tests for duplicate privatenames --- .../class/fields-duplicate-privatenames.js | 24 +++++++++++++++++++ .../class/fields-duplicate-privatenames.js | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/language/expressions/class/fields-duplicate-privatenames.js create mode 100644 test/language/statements/class/fields-duplicate-privatenames.js diff --git a/test/language/expressions/class/fields-duplicate-privatenames.js b/test/language/expressions/class/fields-duplicate-privatenames.js new file mode 100644 index 0000000000..8d1d03da14 --- /dev/null +++ b/test/language/expressions/class/fields-duplicate-privatenames.js @@ -0,0 +1,24 @@ +// Copyright 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Syntax error if the same private field defined twice +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +negative: + phase: early + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries. +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var C = class { + #x; + #x; +} diff --git a/test/language/statements/class/fields-duplicate-privatenames.js b/test/language/statements/class/fields-duplicate-privatenames.js new file mode 100644 index 0000000000..ee77d36ae2 --- /dev/null +++ b/test/language/statements/class/fields-duplicate-privatenames.js @@ -0,0 +1,24 @@ +// Copyright 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Syntax error if the same private field defined twice +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +negative: + phase: early + type: SyntaxError +info: | + Static Semantics: Early Errors + + ClassBody : ClassElementList + It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries. +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + #x; + #x; +}