mirror of https://github.com/tc39/test262.git
Re-organize class tests
The `test/language/class/` directory contains a small subset of Test262's tests for ES2015 classes. The majority of tests for classes are organized within `test/language/statements/class/`. - Move the tests that rely on the ClassDeclaration syntactic form from `test/language/class/` to `test/language/statements/class/`. - Move the test that relies on the ClassExpression syntactic form from `test/language/class/` to `test/language/expressions/class/`.
This commit is contained in:
parent
1bc6441cae
commit
6646d3e94f
|
@ -1,7 +1,7 @@
|
|||
// Copyright (C) 2015 Caitlin Potter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
/*---
|
||||
description: >
|
||||
Functions created using ClassExpression syntactic form do not
|
||||
have own properties "caller" or "arguments", but inherit them from
|
||||
|
@ -11,8 +11,12 @@ es6id: 16.1
|
|||
|
||||
var BaseClass = class {};
|
||||
|
||||
assert.sameValue(BaseClass.hasOwnProperty('caller'), false, 'Functions created using ClassExpression syntactic form do not have own property "caller"');
|
||||
assert.sameValue(BaseClass.hasOwnProperty('arguments'), false, 'Functions created using ClassExpression syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(
|
||||
BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property'
|
||||
);
|
||||
assert.sameValue(
|
||||
BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
return BaseClass.caller;
|
||||
|
@ -32,8 +36,12 @@ assert.throws(TypeError, function() {
|
|||
|
||||
var SubClass = class extends BaseClass {};
|
||||
|
||||
assert.sameValue(SubClass.hasOwnProperty('caller'), false, 'Functions created using ClassExpression syntactic form do not have own property "caller"');
|
||||
assert.sameValue(SubClass.hasOwnProperty('arguments'), false, 'Functions created using ClassExpression syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(
|
||||
SubClass.hasOwnProperty('caller'), false, 'No "caller" own property'
|
||||
);
|
||||
assert.sameValue(
|
||||
SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
return SubClass.caller;
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright (C) 2015 Caitlin Potter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
/*---
|
||||
description: >
|
||||
Functions created using MethodDefinition syntactic form do not
|
||||
have own properties "caller" or "arguments", but inherit them from
|
||||
Functions created using MethodDefinition syntactic form do not have own
|
||||
properties "caller" or "arguments", but inherit them from
|
||||
%FunctionPrototype%.
|
||||
es6id: 16.1
|
||||
---*/
|
||||
|
@ -18,12 +18,36 @@ class Class {
|
|||
var instance = new Class;
|
||||
var accessor = Object.getOwnPropertyDescriptor(Class.prototype, "accessor");
|
||||
|
||||
assert.sameValue(instance.method.hasOwnProperty('caller'), false, 'Functions created using MethodDefinition syntactic form do not have own property "caller"');
|
||||
assert.sameValue(instance.method.hasOwnProperty('arguments'), false, 'Functions created using MethodDefinition syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(accessor.get.hasOwnProperty('caller'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "caller"');
|
||||
assert.sameValue(accessor.get.hasOwnProperty('arguments'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(accessor.set.hasOwnProperty('caller'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "caller"');
|
||||
assert.sameValue(accessor.set.hasOwnProperty('arguments'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(
|
||||
instance.method.hasOwnProperty('caller'),
|
||||
false,
|
||||
'No "caller" own property (method)'
|
||||
);
|
||||
assert.sameValue(
|
||||
instance.method.hasOwnProperty('arguments'),
|
||||
false,
|
||||
'No "arguments" own property (method)'
|
||||
);
|
||||
assert.sameValue(
|
||||
accessor.get.hasOwnProperty('caller'),
|
||||
false,
|
||||
'No "caller" own property ("get" accessor)'
|
||||
);
|
||||
assert.sameValue(
|
||||
accessor.get.hasOwnProperty('arguments'),
|
||||
false,
|
||||
'No "arguments" own property ("get" accessor)'
|
||||
);
|
||||
assert.sameValue(
|
||||
accessor.set.hasOwnProperty('caller'),
|
||||
false,
|
||||
'No "caller" own property ("set" accessor)'
|
||||
);
|
||||
assert.sameValue(
|
||||
accessor.set.hasOwnProperty('arguments'),
|
||||
false,
|
||||
'No "arguments" own property ("set" accessor)'
|
||||
);
|
||||
|
||||
// --- Test method restricted properties throw
|
||||
|
||||
|
@ -78,4 +102,3 @@ assert.throws(TypeError, function() {
|
|||
assert.throws(TypeError, function() {
|
||||
accessor.set.arguments = {};
|
||||
});
|
||||
|
|
@ -1,18 +1,22 @@
|
|||
// Copyright (C) 2015 Caitlin Potter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
/*---
|
||||
description: >
|
||||
Functions created using ClassDeclaration syntactic form do not
|
||||
have own properties "caller" or "arguments", but inherit them from
|
||||
Functions created using ClassDeclaration syntactic form do not have own
|
||||
properties "caller" or "arguments", but inherit them from
|
||||
%FunctionPrototype%.
|
||||
es6id: 16.1
|
||||
---*/
|
||||
|
||||
class BaseClass {}
|
||||
|
||||
assert.sameValue(BaseClass.hasOwnProperty('caller'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "caller"');
|
||||
assert.sameValue(BaseClass.hasOwnProperty('arguments'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(
|
||||
BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property'
|
||||
);
|
||||
assert.sameValue(
|
||||
BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
return BaseClass.caller;
|
||||
|
@ -32,8 +36,12 @@ assert.throws(TypeError, function() {
|
|||
|
||||
class SubClass extends BaseClass {}
|
||||
|
||||
assert.sameValue(SubClass.hasOwnProperty('caller'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "caller"');
|
||||
assert.sameValue(SubClass.hasOwnProperty('arguments'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "arguments"');
|
||||
assert.sameValue(
|
||||
SubClass.hasOwnProperty('caller'), false, 'No "caller" own property'
|
||||
);
|
||||
assert.sameValue(
|
||||
SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
return SubClass.caller;
|
Loading…
Reference in New Issue