Index: test/mjsunit/harmony/classes.js |
diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js |
index 1b19a13193a45e7205ba8e1070015184a8240dc2..0e2145785cc8a873d5d632039eae83905f06905b 100644 |
--- a/test/mjsunit/harmony/classes.js |
+++ b/test/mjsunit/harmony/classes.js |
@@ -875,3 +875,51 @@ function assertAccessorDescriptor(object, name) { |
}; |
new C3(); |
}()); |
+ |
+ |
+function testClassRestrictedProperties(C) { |
+ assertEquals(false, C.hasOwnProperty("arguments")); |
+ assertEquals(null, C.arguments); |
+ |
+ assertEquals(false, C.hasOwnProperty("caller")); |
+ assertEquals(null, C.caller); |
+ |
+ assertEquals(false, (new C).method.hasOwnProperty("arguments")); |
+ assertEquals(null, (new C).method.arguments); |
+ |
+ assertEquals(false, (new C).method.hasOwnProperty("caller")); |
+ assertEquals(null, (new C).method.caller); |
+} |
+ |
+ |
+(function testRestrictedPropertiesStrict() { |
+ "use strict"; |
+ class ClassWithDefaultConstructor { |
+ method() {} |
+ } |
+ class Class { |
+ constructor() {} |
+ method() {} |
+ } |
arv (Not doing code reviews)
2015/03/25 13:36:47
Maybe have a derived class too?
|
+ |
+ testClassRestrictedProperties(ClassWithDefaultConstructor); |
+ testClassRestrictedProperties(Class); |
+ testClassRestrictedProperties(class { method() {} }); |
+ testClassRestrictedProperties(class { constructor() {} method() {} }); |
+})(); |
+ |
+ |
+(function testRestrictedPropertiesSloppy() { |
+ class ClassWithDefaultConstructor { |
+ method() {} |
+ } |
+ class Class { |
+ constructor() {} |
+ method() {} |
+ } |
+ |
+ testClassRestrictedProperties(ClassWithDefaultConstructor); |
+ testClassRestrictedProperties(Class); |
+ testClassRestrictedProperties(class { method() {} }); |
+ testClassRestrictedProperties(class { constructor() {} method() {} }); |
+})(); |