Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: test/mjsunit/harmony/computed-property-names-classes.js

Issue 985643003: [es6] Throw TypeError for computed static prototype property name (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Inline BuildThrowStaticPrototype Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/computed-property-names-classes.js
diff --git a/test/mjsunit/harmony/computed-property-names-classes.js b/test/mjsunit/harmony/computed-property-names-classes.js
index 8a2b778edd73087d71c63cb2094e845e2ac23949..ab5d39e867c65b9658a01a3f6d4727d05173254c 100644
--- a/test/mjsunit/harmony/computed-property-names-classes.js
+++ b/test/mjsunit/harmony/computed-property-names-classes.js
@@ -312,41 +312,74 @@ function assertIteratorResult(value, done, result) {
(function TestPrototype() {
- // Normally a static prototype property is not allowed.
- class C {
- static ['prototype']() {
- return 1;
+ assertThrows(function() {
+ class C {
+ static ['prototype']() {
+ return 1;
+ }
}
- }
- assertEquals(1, C.prototype());
+ }, TypeError);
- class C2 {
- static get ['prototype']() {
- return 2;
+ assertThrows(function() {
+ class C2 {
+ static get ['prototype']() {
+ return 2;
+ }
}
- }
- assertEquals(2, C2.prototype);
+ }, TypeError);
- var calls = 0;
- class C3 {
- static set ['prototype'](x) {
- assertEquals(3, x);
- calls++;
+ assertThrows(function() {
+ class C3 {
+ static set ['prototype'](x) {
+ assertEquals(3, x);
+ }
}
- }
- C3.prototype = 3;
- assertEquals(1, calls);
+ }, TypeError);
- class C4 {
- static *['prototype']() {
- yield 1;
- yield 2;
+ assertThrows(function() {
+ class C4 {
+ static *['prototype']() {
+ yield 1;
+ yield 2;
+ }
}
- }
- var iter = C4.prototype();
- assertIteratorResult(1, false, iter.next());
- assertIteratorResult(2, false, iter.next());
- assertIteratorResult(undefined, true, iter.next());
+ }, TypeError);
+})();
+
+
+(function TestPrototypeConcat() {
+ assertThrows(function() {
+ class C {
+ static ['pro' + 'tot' + 'ype']() {
+ return 1;
+ }
+ }
+ }, TypeError);
+
+ assertThrows(function() {
+ class C2 {
+ static get ['pro' + 'tot' + 'ype']() {
+ return 2;
+ }
+ }
+ }, TypeError);
+
+ assertThrows(function() {
+ class C3 {
+ static set ['pro' + 'tot' + 'ype'](x) {
+ assertEquals(3, x);
+ }
+ }
+ }, TypeError);
+
+ assertThrows(function() {
+ class C4 {
+ static *['pro' + 'tot' + 'ype']() {
+ yield 1;
+ yield 2;
+ }
+ }
+ }, TypeError);
})();
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698