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 364 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.3.2
description: >
The initial value of RangeError.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(RangeError.prototype.message, "");
verifyNotEnumerable(RangeError.prototype, "message");
verifyWritable(RangeError.prototype, "message");
verifyConfigurable(RangeError.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 RangeError.prototype.name is "RangeError".
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(RangeError.prototype.name, "RangeError");
verifyNotEnumerable(RangeError.prototype, "name");
verifyWritable(RangeError.prototype, "name");
verifyConfigurable(RangeError.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: >
RangeError.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(RangeError.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 RangeError.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(RangeError.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: >
ReferenceError is a constructor function.
---*/
assert.sameValue(typeof ReferenceError, 'function', 'typeof ReferenceError 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 ReferenceError instances is ReferenceError.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 ReferenceError), ReferenceError.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: >
ReferenceError 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 ReferenceError), "[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: >
ReferenceError.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(ReferenceError.length, 1);
verifyNotEnumerable(ReferenceError, "length");
verifyNotWritable(ReferenceError, "length");
verifyConfigurable(ReferenceError, "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: >
ReferenceError.name is "ReferenceError".
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(ReferenceError.name, "ReferenceError");
verifyNotEnumerable(ReferenceError, "name");
verifyNotWritable(ReferenceError, "name");
verifyConfigurable(ReferenceError, "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 ReferenceError 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(ReferenceError), 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 ReferenceError.prototype is the ReferenceError 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(ReferenceError.prototype, Object.getPrototypeOf(new ReferenceError));
verifyNotEnumerable(ReferenceError, "prototype");
verifyNotWritable(ReferenceError, "prototype");
verifyNotConfigurable(ReferenceError, "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 ReferenceError.prototype.constructor is the ReferenceError 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(ReferenceError.prototype.constructor, ReferenceError);
verifyNotEnumerable(ReferenceError.prototype, "constructor");
verifyWritable(ReferenceError.prototype, "constructor");
verifyConfigurable(ReferenceError.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 ReferenceError.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(ReferenceError.prototype.message, "");
verifyNotEnumerable(ReferenceError.prototype, "message");
verifyWritable(ReferenceError.prototype, "message");
verifyConfigurable(ReferenceError.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 ReferenceError.prototype.name is "ReferenceError".
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(ReferenceError.prototype.name, "ReferenceError");
verifyNotEnumerable(ReferenceError.prototype, "name");
verifyWritable(ReferenceError.prototype, "name");
verifyConfigurable(ReferenceError.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: >
ReferenceError.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(ReferenceError.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 ReferenceError.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(ReferenceError.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: >
SyntaxError is a constructor function.
---*/
assert.sameValue(typeof SyntaxError, 'function', 'typeof SyntaxError 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 SyntaxError instances is SyntaxError.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 SyntaxError), SyntaxError.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: >
SyntaxError 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 SyntaxError), "[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: >
SyntaxError.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(SyntaxError.length, 1);
verifyNotEnumerable(SyntaxError, "length");
verifyNotWritable(SyntaxError, "length");
verifyConfigurable(SyntaxError, "length");
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