Skip to content
Snippets Groups Projects
Commit 33395b52 authored by André Bargull's avatar André Bargull
Browse files

Add basic surface tests for NativeErrors

parent 1bac79fb
No related branches found
No related tags found
No related merge requests found
Showing
with 369 additions and 0 deletions
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.1
description: >
EvalError is a constructor function.
---*/
assert.sameValue(typeof EvalError, 'function', 'typeof EvalError is "function"');
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.4
description: >
The prototype of EvalError instances is EvalError.prototype.
info: >
NativeError instances are ordinary objects that inherit properties
from their NativeError prototype object and have an [[ErrorData]]
internal slot whose value is undefined
---*/
assert.sameValue(Object.getPrototypeOf(new EvalError), EvalError.prototype);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.4
description: >
EvalError instances have an [[ErrorData]] internal slot.
info: >
NativeError instances are ordinary objects that inherit properties
from their NativeError prototype object and have an [[ErrorData]]
internal slot whose value is undefined
---*/
assert.sameValue(Object.prototype.toString.call(new EvalError), "[object Error]");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2
description: >
EvalError.length is 1.
info: >
NativeError ( message )
19.5.6.2 Properties of the NativeError Constructors
Besides the length property (whose value is 1) [...].
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description, including optional
parameters. However, rest parameters shown using the form “...name”
are not included in the default argument count.
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.length, 1);
verifyNotEnumerable(EvalError, "length");
verifyNotWritable(EvalError, "length");
verifyConfigurable(EvalError, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.1
description: >
EvalError.name is "EvalError".
info: >
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.name, "EvalError");
verifyNotEnumerable(EvalError, "name");
verifyNotWritable(EvalError, "name");
verifyConfigurable(EvalError, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2
description: >
The prototype of EvalError is Error.
info: >
The value of the [[Prototype]] internal slot of a NativeError constructor is the intrinsic object %Error% (19.5.1).
---*/
assert.sameValue(Object.getPrototypeOf(EvalError), Error);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2.1
description: >
The initial value of EvalError.prototype is the EvalError prototype object.
info: >
The initial value of NativeError.prototype is a NativeError prototype object (19.5.6.3).
Each NativeError constructor has a distinct prototype object.
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.prototype, Object.getPrototypeOf(new EvalError));
verifyNotEnumerable(EvalError, "prototype");
verifyNotWritable(EvalError, "prototype");
verifyNotConfigurable(EvalError, "prototype");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3.1
description: >
The initial value of EvalError.prototype.constructor is the EvalError object.
info: >
The initial value of the constructor property of the prototype for a given NativeError
constructor is the corresponding intrinsic object %NativeError% (19.5.6.1).
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2 has
the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
unless otherwise specified.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.prototype.constructor, EvalError);
verifyNotEnumerable(EvalError.prototype, "constructor");
verifyWritable(EvalError.prototype, "constructor");
verifyConfigurable(EvalError.prototype, "constructor");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3.2
description: >
The initial value of EvalError.prototype.message is the empty string.
info: >
The initial value of the message property of the prototype for a given NativeError
constructor is the empty String.
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2 has
the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
unless otherwise specified.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.prototype.message, "");
verifyNotEnumerable(EvalError.prototype, "message");
verifyWritable(EvalError.prototype, "message");
verifyConfigurable(EvalError.prototype, "message");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3.3
description: >
The initial value of EvalError.prototype.name is "EvalError".
info: >
The initial value of the name property of the prototype for a given NativeError
constructor is a string consisting of the name of the constructor (the name used
instead of NativeError).
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2 has
the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
unless otherwise specified.
includes: [propertyHelper.js]
---*/
assert.sameValue(EvalError.prototype.name, "EvalError");
verifyNotEnumerable(EvalError.prototype, "name");
verifyWritable(EvalError.prototype, "name");
verifyConfigurable(EvalError.prototype, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3
description: >
EvalError.prototype is not an error object instance.
info: >
Each NativeError prototype object is an ordinary object. It is not an
Error instance and does not have an [[ErrorData]] internal slot.
---*/
assert.sameValue(Object.prototype.toString.call(EvalError.prototype), "[object Object]");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3
description: >
The prototype of EvalError.prototype is Error.prototype.
info: >
The value of the [[Prototype]] internal slot of each NativeError prototype
object is the intrinsic object %ErrorPrototype% (19.5.3).
---*/
assert.sameValue(Object.getPrototypeOf(EvalError.prototype), Error.prototype);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.1
description: >
RangeError is a constructor function.
---*/
assert.sameValue(typeof RangeError, 'function', 'typeof RangeError is "function"');
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.4
description: >
The prototype of RangeError instances is RangeError.prototype.
info: >
NativeError instances are ordinary objects that inherit properties
from their NativeError prototype object and have an [[ErrorData]]
internal slot whose value is undefined
---*/
assert.sameValue(Object.getPrototypeOf(new RangeError), RangeError.prototype);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.4
description: >
RangeError instances have an [[ErrorData]] internal slot.
info: >
NativeError instances are ordinary objects that inherit properties
from their NativeError prototype object and have an [[ErrorData]]
internal slot whose value is undefined
---*/
assert.sameValue(Object.prototype.toString.call(new RangeError), "[object Error]");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2
description: >
RangeError.length is 1.
info: >
NativeError ( message )
19.5.6.2 Properties of the NativeError Constructors
Besides the length property (whose value is 1) [...].
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description, including optional
parameters. However, rest parameters shown using the form “...name”
are not included in the default argument count.
Unless otherwise specified, the length property of a built-in Function
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(RangeError.length, 1);
verifyNotEnumerable(RangeError, "length");
verifyNotWritable(RangeError, "length");
verifyConfigurable(RangeError, "length");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.1
description: >
RangeError.name is "RangeError".
info: >
17 ECMAScript Standard Built-in Objects:
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value
is a String.
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(RangeError.name, "RangeError");
verifyNotEnumerable(RangeError, "name");
verifyNotWritable(RangeError, "name");
verifyConfigurable(RangeError, "name");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2
description: >
The prototype of RangeError is Error.
info: >
The value of the [[Prototype]] internal slot of a NativeError constructor is the intrinsic object %Error% (19.5.1).
---*/
assert.sameValue(Object.getPrototypeOf(RangeError), Error);
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.2.1
description: >
The initial value of RangeError.prototype is the RangeError prototype object.
info: >
The initial value of NativeError.prototype is a NativeError prototype object (19.5.6.3).
Each NativeError constructor has a distinct prototype object.
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
includes: [propertyHelper.js]
---*/
assert.sameValue(RangeError.prototype, Object.getPrototypeOf(new RangeError));
verifyNotEnumerable(RangeError, "prototype");
verifyNotWritable(RangeError, "prototype");
verifyNotConfigurable(RangeError, "prototype");
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.5.6.3.1
description: >
The initial value of RangeError.prototype.constructor is the RangeError object.
info: >
The initial value of the constructor property of the prototype for a given NativeError
constructor is the corresponding intrinsic object %NativeError% (19.5.6.1).
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2 has
the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
unless otherwise specified.
includes: [propertyHelper.js]
---*/
assert.sameValue(RangeError.prototype.constructor, RangeError);
verifyNotEnumerable(RangeError.prototype, "constructor");
verifyWritable(RangeError.prototype, "constructor");
verifyConfigurable(RangeError.prototype, "constructor");
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment