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:
Mike Pennisi 2015-07-09 15:36:14 -04:00
parent 1bc6441cae
commit 6646d3e94f
22 changed files with 61 additions and 22 deletions

View File

@ -1,7 +1,7 @@
// Copyright (C) 2015 Caitlin Potter. All rights reserved. // Copyright (C) 2015 Caitlin Potter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
Functions created using ClassExpression syntactic form do not Functions created using ClassExpression syntactic form do not
have own properties "caller" or "arguments", but inherit them from have own properties "caller" or "arguments", but inherit them from
@ -11,8 +11,12 @@ es6id: 16.1
var BaseClass = class {}; var BaseClass = class {};
assert.sameValue(BaseClass.hasOwnProperty('caller'), false, 'Functions created using ClassExpression syntactic form do not have own property "caller"'); assert.sameValue(
assert.sameValue(BaseClass.hasOwnProperty('arguments'), false, 'Functions created using ClassExpression syntactic form do not have own property "arguments"'); BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property'
);
assert.sameValue(
BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return BaseClass.caller; return BaseClass.caller;
@ -32,8 +36,12 @@ assert.throws(TypeError, function() {
var SubClass = class extends BaseClass {}; 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(
assert.sameValue(SubClass.hasOwnProperty('arguments'), false, 'Functions created using ClassExpression syntactic form do not have own property "arguments"'); SubClass.hasOwnProperty('caller'), false, 'No "caller" own property'
);
assert.sameValue(
SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return SubClass.caller; return SubClass.caller;

View File

@ -1,10 +1,10 @@
// Copyright (C) 2015 Caitlin Potter. All rights reserved. // Copyright (C) 2015 Caitlin Potter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
Functions created using MethodDefinition syntactic form do not Functions created using MethodDefinition syntactic form do not have own
have own properties "caller" or "arguments", but inherit them from properties "caller" or "arguments", but inherit them from
%FunctionPrototype%. %FunctionPrototype%.
es6id: 16.1 es6id: 16.1
---*/ ---*/
@ -18,12 +18,36 @@ class Class {
var instance = new Class; var instance = new Class;
var accessor = Object.getOwnPropertyDescriptor(Class.prototype, "accessor"); 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(
assert.sameValue(instance.method.hasOwnProperty('arguments'), false, 'Functions created using MethodDefinition syntactic form do not have own property "arguments"'); instance.method.hasOwnProperty('caller'),
assert.sameValue(accessor.get.hasOwnProperty('caller'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "caller"'); false,
assert.sameValue(accessor.get.hasOwnProperty('arguments'), false, 'Accessor Functions created using MethodDefinition syntactic form do not have own property "arguments"'); 'No "caller" own property (method)'
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('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 // --- Test method restricted properties throw
@ -78,4 +102,3 @@ assert.throws(TypeError, function() {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
accessor.set.arguments = {}; accessor.set.arguments = {};
}); });

View File

@ -1,18 +1,22 @@
// Copyright (C) 2015 Caitlin Potter. All rights reserved. // Copyright (C) 2015 Caitlin Potter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
description: > description: >
Functions created using ClassDeclaration syntactic form do not Functions created using ClassDeclaration syntactic form do not have own
have own properties "caller" or "arguments", but inherit them from properties "caller" or "arguments", but inherit them from
%FunctionPrototype%. %FunctionPrototype%.
es6id: 16.1 es6id: 16.1
---*/ ---*/
class BaseClass {} class BaseClass {}
assert.sameValue(BaseClass.hasOwnProperty('caller'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "caller"'); assert.sameValue(
assert.sameValue(BaseClass.hasOwnProperty('arguments'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "arguments"'); BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property'
);
assert.sameValue(
BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return BaseClass.caller; return BaseClass.caller;
@ -32,8 +36,12 @@ assert.throws(TypeError, function() {
class SubClass extends BaseClass {} class SubClass extends BaseClass {}
assert.sameValue(SubClass.hasOwnProperty('caller'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "caller"'); assert.sameValue(
assert.sameValue(SubClass.hasOwnProperty('arguments'), false, 'Functions created using ClassDeclaration syntactic form do not have own property "arguments"'); SubClass.hasOwnProperty('caller'), false, 'No "caller" own property'
);
assert.sameValue(
SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property'
);
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return SubClass.caller; return SubClass.caller;