summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValerie R Young <valerie@bocoup.com>2017-10-20 20:03:09 -0400
committerValerie R Young <valerie@bocoup.com>2017-10-27 17:40:42 -0400
commit458e33afe3aa8e5b62938d3cd0de643189759592 (patch)
tree03a9b66c916ad93c3b181897fcc19f80f236bbfd /src
parentf8456c6dacefae23188830a33e300ed53b0eb67b (diff)
downloadqtdeclarative-testsuites-458e33afe3aa8e5b62938d3cd0de643189759592.tar.gz
classfields: add tests for forbidden propertynames
Diffstat (limited to 'src')
-rw-r--r--src/class-fields/propname-constructor.case18
-rw-r--r--src/class-fields/propname-error/cls-decl-computed-name.template22
-rw-r--r--src/class-fields/propname-error/cls-decl-literal-name.template21
-rw-r--r--src/class-fields/propname-error/cls-decl-string-name.template22
-rw-r--r--src/class-fields/propname-error/cls-expr-computed-name.template22
-rw-r--r--src/class-fields/propname-error/cls-expr-literal-name.template21
-rw-r--r--src/class-fields/propname-error/cls-expr-string-name.template22
-rw-r--r--src/class-fields/static-propname-constructor.case20
-rw-r--r--src/class-fields/static-propname-prototype.case20
9 files changed, 188 insertions, 0 deletions
diff --git a/src/class-fields/propname-constructor.case b/src/class-fields/propname-constructor.case
new file mode 100644
index 000000000..a700e9911
--- /dev/null
+++ b/src/class-fields/propname-constructor.case
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+desc: Static class fields cannot have PropName 'constructor'
+info: |
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : FieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "constructor".
+features: [class-fields]
+template: propname-error
+---*/
+
+//- propname
+constructor
diff --git a/src/class-fields/propname-error/cls-decl-computed-name.template b/src/class-fields/propname-error/cls-decl-computed-name.template
new file mode 100644
index 000000000..72e252f80
--- /dev/null
+++ b/src/class-fields/propname-error/cls-decl-computed-name.template
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/statements/class/fields-computed-name-
+name: computed
+info: |
+ Static Semantics: PropName
+ ...
+ ComputedPropertyName : [ AssignmentExpression ]
+ Return empty.
+---*/
+
+var x = "/*{ propname }*/";
+class C {
+ /*{ static }*/ [x];
+}
+
+var c = new C();
+
+assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);
diff --git a/src/class-fields/propname-error/cls-decl-literal-name.template b/src/class-fields/propname-error/cls-decl-literal-name.template
new file mode 100644
index 000000000..b51b78ef2
--- /dev/null
+++ b/src/class-fields/propname-error/cls-decl-literal-name.template
@@ -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.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/statements/class/fields-literal-name-
+name: literal name
+negative:
+ type: SyntaxError
+ phase: early
+info: |
+ Static Semantics: PropName
+ LiteralPropertyName : IdentifierName
+ Return StringValue of IdentifierName.
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+class C {
+ /*{ static }*/ /*{ propname }*/;
+}
diff --git a/src/class-fields/propname-error/cls-decl-string-name.template b/src/class-fields/propname-error/cls-decl-string-name.template
new file mode 100644
index 000000000..173990f66
--- /dev/null
+++ b/src/class-fields/propname-error/cls-decl-string-name.template
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/statements/class/fields-string-name-
+name: string name
+negative:
+ type: SyntaxError
+ phase: early
+info: |
+ Static Semantics: PropName
+ ...
+ LiteralPropertyName:StringLiteral
+ Return the String value whose code units are the SV of the StringLiteral.
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+class C {
+ /*{ static }*/ '/*{ propname }*/';
+}
diff --git a/src/class-fields/propname-error/cls-expr-computed-name.template b/src/class-fields/propname-error/cls-expr-computed-name.template
new file mode 100644
index 000000000..dc3768183
--- /dev/null
+++ b/src/class-fields/propname-error/cls-expr-computed-name.template
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/expressions/class/fields-computed-name-
+name: computed
+info: |
+ Static Semantics: PropName
+ ...
+ ComputedPropertyName : [ AssignmentExpression ]
+ Return empty.
+---*/
+
+var x = "/*{ propname }*/";
+var C = class {
+ /*{ static }*/ [x];
+}
+
+var c = new C();
+
+assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true);
diff --git a/src/class-fields/propname-error/cls-expr-literal-name.template b/src/class-fields/propname-error/cls-expr-literal-name.template
new file mode 100644
index 000000000..84d8310ab
--- /dev/null
+++ b/src/class-fields/propname-error/cls-expr-literal-name.template
@@ -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.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/expressions/class/fields-literal-name-
+name: literal name
+negative:
+ type: SyntaxError
+ phase: early
+info: |
+ Static Semantics: PropName
+ LiteralPropertyName : IdentifierName
+ Return StringValue of IdentifierName.
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+var C = class {
+ /*{ static }*/ /*{ propname }*/;
+}
diff --git a/src/class-fields/propname-error/cls-expr-string-name.template b/src/class-fields/propname-error/cls-expr-string-name.template
new file mode 100644
index 000000000..b6a3af65c
--- /dev/null
+++ b/src/class-fields/propname-error/cls-expr-string-name.template
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-class-definitions-static-semantics-early-errors
+path: language/expressions/class/fields-string-name-
+name: string name
+negative:
+ type: SyntaxError
+ phase: early
+info: |
+ Static Semantics: PropName
+ ...
+ LiteralPropertyName:StringLiteral
+ Return the String value whose code units are the SV of the StringLiteral.
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+var C = class {
+ /*{ static }*/ '/*{ propname }*/';
+}
diff --git a/src/class-fields/static-propname-constructor.case b/src/class-fields/static-propname-constructor.case
new file mode 100644
index 000000000..ffa6754e2
--- /dev/null
+++ b/src/class-fields/static-propname-constructor.case
@@ -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.
+
+/*---
+desc: Static class field cannot have PropName 'constructor'
+info: |
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+features: [class-fields]
+template: propname-error
+---*/
+
+//- static
+static
+//- propname
+constructor
diff --git a/src/class-fields/static-propname-prototype.case b/src/class-fields/static-propname-prototype.case
new file mode 100644
index 000000000..9b2e9ab33
--- /dev/null
+++ b/src/class-fields/static-propname-prototype.case
@@ -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.
+
+/*---
+desc: Static class fields cannot have PropName 'prototype'
+info: |
+
+ // This test file tests the following early error:
+ Static Semantics: Early Errors
+
+ ClassElement : staticFieldDefinition;
+ It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor".
+features: [class-fields]
+template: propname-error
+---*/
+
+//- static
+static
+//- propname
+prototype