diff options
author | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
---|---|---|
committer | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
commit | 8aa878d3aff9785f4b8c1207b1adbec07a6ff790 (patch) | |
tree | 7cceccd22522fa9ceacd8f8b0ab510567f5c7c27 /test/suite/ch15/15.11 | |
parent | d032342322ca26edb5aa34939cda434538e8aefb (diff) | |
download | test262-8aa878d3aff9785f4b8c1207b1adbec07a6ff790.tar.gz |
Renamed Sputnik directories.
Diffstat (limited to 'test/suite/ch15/15.11')
25 files changed, 654 insertions, 0 deletions
diff --git a/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A1_T1.js b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A1_T1.js new file mode 100644 index 000000000..bbde5f28e --- /dev/null +++ b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A1_T1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If the argument "message" is not undefined, the message property of the newly constructed object is + * set to ToString(message) + * + * @path 15_Native/15.11_Error_Objects/15.11.1_The_Error_Constructor_Called_as_a_Function/S15.11.1.1_A1_T1.js + * @description Checking message property of different error objects + */ + +function otherScope(msg) +{ + return Error(msg); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=Error('msg1'); +if(err1.message!=="msg1"){ + $ERROR('#1: var err1=Error(\'msg1\'); err1.message==="msg1". Actual: '+err1.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var err2=otherScope('msg2'); +if(err2.message!=="msg2"){ + $ERROR('#2: function otherScope(msg){return Error(msg);} var err2=otherScope(\'msg2\'); err2.message==="msg2". Actual: '+err2.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var err3=otherScope(); +if(err3.hasOwnProperty('message')){ + $ERROR('#3: function otherScope(msg){return Error(msg);} var err3=otherScope(); err3.hasOwnProperty("message"). Actual: '+err3.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +var err4=eval("Error('msg4')"); +if(err4.message!=="msg4"){ + $ERROR('#4: var err4=eval("Error(\'msg4\')"); err4.message==="msg4". Actual: '+err4.message); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A2_T1.js b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A2_T1.js new file mode 100644 index 000000000..8b4a0a7ed --- /dev/null +++ b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A2_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The [[Prototype]] property of the newly constructed object is set to the original Error prototype + * object, the one that is the initial value of Error.prototype (15.11.3.1) + * + * @path 15_Native/15.11_Error_Objects/15.11.1_The_Error_Constructor_Called_as_a_Function/S15.11.1.1_A2_T1.js + * @description Checking prototype of the newly constructed Error object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=Error('msg1'); +if(!Error.prototype.isPrototypeOf(err1)){ + $ERROR('#1: var err1=Error(\'msg1\'); Error.prototype.isPrototypeOf(err1) return true. Actual: '+Error.prototype.isPrototypeOf(err1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A3_T1.js b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A3_T1.js new file mode 100644 index 000000000..4681bf0a8 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.1/S15.11.1.1_A3_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The [[Class]] property of the newly constructed object is set to "Error" + * + * @path 15_Native/15.11_Error_Objects/15.11.1_The_Error_Constructor_Called_as_a_Function/S15.11.1.1_A3_T1.js + * @description Checking Class of the newly constructed Error object using toSting() function + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +Error.prototype.toString=Object.prototype.toString; +var err1=Error(); +if(err1.toString()!=='[object '+ 'Error' +']'){ + $ERROR('#1: Error.prototype.toString=Object.prototype.toString; var err1=Error(); err1.toString()===\'[object Error]\'. Actual: '+err1.toString()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.1/S15.11.1_A1_T1.js b/test/suite/ch15/15.11/15.11.1/S15.11.1_A1_T1.js new file mode 100644 index 000000000..c576a4d24 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.1/S15.11.1_A1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The function call Error(...) is equivalent to the object creation expression new + * Error(...) with the same arguments + * + * @path 15_Native/15.11_Error_Objects/15.11.1_The_Error_Constructor_Called_as_a_Function/S15.11.1_A1_T1.js + * @description Checking constructor of the newly constructed Error object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +Error.prototype.toString=Object.prototype.toString; +var err1=Error(); +if(err1.constructor!==Error){ + $ERROR('#1: Error.prototype.toString=Object.prototype.toString; var err1=Error(); err1.constructor===Error. Actual: '+err1.constructor); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A1_T1.js b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A1_T1.js new file mode 100644 index 000000000..7291bc3fa --- /dev/null +++ b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A1_T1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If the argument "message" is not undefined, the message property of the newly constructed object is + * set to ToString(message) + * + * @path 15_Native/15.11_Error_Objects/15.11.2_The_Error_Constructor/S15.11.2.1_A1_T1.js + * @description Checking message property of different error objects + */ + +function otherScope(msg) +{ + return new Error(msg); +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=new Error('msg1'); +if(err1.message!=="msg1"){ + $ERROR('#1: var err1=new Error(\'msg1\'); err1.message==="msg1". Actual: '+err1.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var err2=otherScope('msg2'); +if(err2.message!=="msg2"){ + $ERROR('#2: function otherScope(msg){return new Error(msg);} var err2=otherScope(\'msg2\'); err2.message==="msg2". Actual: '+err2.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var err3=otherScope(); +if(err3.hasOwnProperty('message')){ + $ERROR('#3: function otherScope(msg){return new Error(msg);} var err3=otherScope(); err3.hasOwnProperty("message"). Actual: '+err3.message); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +var err4=eval("new Error('msg4')"); +if(err4.message!=="msg4"){ + $ERROR('#4: var err4=eval("new Error(\'msg4\')"); err4.message==="msg4". Actual: '+err4.message); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A2_T1.js b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A2_T1.js new file mode 100644 index 000000000..7f7fe4f61 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A2_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The [[Prototype]] property of the newly constructed object is set to the original Error prototype + * object, the one that is the initial value of Error.prototype (15.11.3.1) + * + * @path 15_Native/15.11_Error_Objects/15.11.2_The_Error_Constructor/S15.11.2.1_A2_T1.js + * @description Checking prototype of the newly constructed Error object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=new Error('msg1'); +if(!Error.prototype.isPrototypeOf(err1)){ + $ERROR('#1: Error.prototype.isPrototypeOf(err1) return true. Actual: '+Error.prototype.isPrototypeOf(err1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A3_T1.js b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A3_T1.js new file mode 100644 index 000000000..fcddb36e8 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.2/S15.11.2.1_A3_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The [[Class]] property of the newly constructed object is set to "Error" + * + * @path 15_Native/15.11_Error_Objects/15.11.2_The_Error_Constructor/S15.11.2.1_A3_T1.js + * @description Checking Class of the newly constructed Error object using toSting() function + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +Error.prototype.toString=Object.prototype.toString; +var err1=new Error(); +if(err1.toString()!=='[object '+ 'Error' +']'){ + $ERROR('#1: err1.toString()===\'[object Error]\'. Actual: '+err1.toString()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A1_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A1_T1.js new file mode 100644 index 000000000..6eefe4850 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Error.prototype property has the attributes {DontDelete} + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3.1_A1_T1.js + * @description Checking if deleting the Error.prototype property fails + */ + +var proto=Error.prototype; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(delete Error.prototype){ + $ERROR('#1: delete Error.prototype return false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(Error.prototype!==proto){ + $ERROR('#2: var proto=Error.prototype; delete Error.prototype; Error.prototype===proto. Actual: '+Error.prototype); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A2_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A2_T1.js new file mode 100644 index 000000000..1d76cb9e0 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A2_T1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Error.prototype property has the attributes {DontEnum} + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3.1_A2_T1.js + * @description Checking if enumerating the Error.prototype property fails + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#0 +if (!(Error.hasOwnProperty('prototype'))) { + $ERROR('#0: Error.hasOwnProperty(\'prototype\') return true. Actual: '+Error.hasOwnProperty('prototype')); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (Error.propertyIsEnumerable('prototype')) { + $ERROR('#1: Error.propertyIsEnumerable(\'prototype\') return false. Actual: '+Error.propertyIsEnumerable('prototype')); +} +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +// CHECK#2 +cout=0; + +for (p in Error){ + if (p==="prototype") cout++; +} + +if (cout !== 0) { + $ERROR('#2: cout === 0. Actual: '+cout ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A3_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A3_T1.js new file mode 100644 index 000000000..fce75c8e2 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A3_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Error.prototype property has the attributes {ReadOnly} + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3.1_A3_T1.js + * @description Checking if varying the Error.prototype property fails + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(Error.hasOwnProperty('prototype'))) { + $ERROR('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: '+Error.hasOwnProperty('prototype')); +} +// +////////////////////////////////////////////////////////////////////////////// + +__obj = Error.prototype; + +Error.prototype = function(){return "shifted";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (Error.prototype !== __obj) { + $ERROR('#2: __obj = Error.prototype; Error.prototype = function(){return "shifted";}; Error.prototype === __obj. Actual: '+Error.prototype ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try { + Error.prototype(); + $ERROR('#3: "Error.prototype()" lead to throwing exception'); +} catch (e) { + ; +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A4_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A4_T1.js new file mode 100644 index 000000000..804fa6f21 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3.1_A4_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Error has property prototype + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3.1_A4_T1.js + * @description Checking Error.hasOwnProperty('prototype') + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(Error.hasOwnProperty('prototype'))) { + $ERROR('#1: Error.hasOwnProperty(\'prototype\') return true. Actual: '+Error.hasOwnProperty('prototype')); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3_A1_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3_A1_T1.js new file mode 100644 index 000000000..c0ed7fc2b --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3_A1_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The value of the internal [[Prototype]] property of the Error constructor is the Function prototype object(15.3.4) + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3_A1_T1.js + * @description Checking prototype of constructor of the newly constructed Error object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=Error("err"); +if(!Function.prototype.isPrototypeOf(err1.constructor)){ + $ERROR('#1: var err1=Error("err"); Function.prototype.isPrototypeOf(err1.constructor) return true. Actual:'+Function.prototype.isPrototypeOf(err1.constructor)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(!Function.prototype.isPrototypeOf(Error.constructor)){ + $ERROR('#2: Function.prototype.isPrototypeOf(Error.constructor) return true. Actual:'+Function.prototype.isPrototypeOf(Error.constructor)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.3/S15.11.3_A2_T1.js b/test/suite/ch15/15.11/15.11.3/S15.11.3_A2_T1.js new file mode 100644 index 000000000..3063a58cd --- /dev/null +++ b/test/suite/ch15/15.11/15.11.3/S15.11.3_A2_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The length property value is 1 + * + * @path 15_Native/15.11_Error_Objects/15.11.3_Properties_of_the_Error_Constructor/S15.11.3_A2_T1.js + * @description Checking length property + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var err1=Error("err"); +if(err1.constructor.length!==1){ + $ERROR('#1: var err1=Error("err"); err1.constructor.length===1. Actual: '+err1.constructor.length); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if(Error.constructor.length!==1){ + $ERROR('#2: Error.constructor.length===1. Actual: '+Error.constructor.length); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T1.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T1.js new file mode 100644 index 000000000..99c950e50 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of Error.prototype.constructor is the built-in Error constructor + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.1_A1_T1.js + * @description Checking Error.prototype.constructor + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (Error.prototype.constructor !== Error) { + $ERROR('#1: Error.prototype.constructor === Error. Actual: '+Error.prototype.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T2.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T2.js new file mode 100644 index 000000000..0804763e0 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.1_A1_T2.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of Error.prototype.constructor is the built-in Error constructor + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.1_A1_T2.js + * @description Checking if creating "new Error.prototype.constructor" passes and checking its properties + */ + +constr = Error.prototype.constructor; + +err = new constr; + +////////////////////////////////////////////////////////////////////////////// +// CHECK#0 +if (err === undefined) { + $ERROR('#0: constr = Error.prototype.constructor; err = new constr; err === undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (err.constructor !== Error) { + $ERROR('#1: constr = Error.prototype.constructor; err = new constr; err.constructor === Error. Actual: '+err.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#2 +if (!(Error.prototype.isPrototypeOf(err))) { + $ERROR('#2: constr = Error.prototype.constructor; err = new constr; Error.prototype.isPrototypeOf(err) return true. Actual: '+Error.prototype.isPrototypeOf(err)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#3 +Error.prototype.toString=Object.prototype.toString; +to_string_result = '[object '+ 'Error' +']'; +if (err.toString() !== to_string_result) { + $ERROR('#3: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.toString() === \'[object Error]\'. Actual: '+err.toString() ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// CHECK#4 +if (err.valueOf().toString() !== to_string_result) { + $ERROR('#4: constr = Error.prototype.constructor; err = new constr; Error.prototype.toString=Object.prototype.toString; err.valueOf().toString() === \'[object Error]\'. Actual: '+err.valueOf().toString() ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A1.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A1.js new file mode 100644 index 000000000..5ed322cae --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Error.prototype has name property + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.2_A1.js + * @description Checking Error.prototype.name + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (!Error.prototype.hasOwnProperty('name')) { + $ERROR('#1: Error.prototype.hasOwnProperty(\'name\') return true. Actual: '+Error.prototype.hasOwnProperty('name')); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A2.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A2.js new file mode 100644 index 000000000..106f73680 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.2_A2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of Error.prototype.name is "Error" + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.2_A2.js + * @description Checking value of Error.prototype.name + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (Error.prototype.name!=="Error") { + $ERROR('#1: Error.prototype.name==="Error". Actual: '+Error.prototype.name); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A1.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A1.js new file mode 100644 index 000000000..c09ee8487 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Error.prototype has message property + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.3_A1.js + * @description Checking Error.prototype.message + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (!Error.prototype.hasOwnProperty('message')) { + $ERROR('#1: Error.prototype.hasOwnProperty(\'message\') reurn true. Actual: '+Error.prototype.hasOwnProperty('message')); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A2.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A2.js new file mode 100644 index 000000000..39f5938de --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.3_A2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of Error.prototype.message is "" + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.3_A2.js + * @description Checking value of Error.prototype.message + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (typeof Error.prototype.message !== "string") { + $ERROR('#1: typeof Error.prototype.message === "string". Actual: ' + Error.prototype.message); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A1.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A1.js new file mode 100644 index 000000000..278371fc4 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Error.prototype has toString property + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.4_A1.js + * @description Checking Error.prototype.toString + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (!Error.prototype.hasOwnProperty('toString')) { + $ERROR('#1: Error.prototype.hasOwnProperty(\'toString\') return true. Actual: '+Error.prototype.hasOwnProperty('toString')); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A2.js b/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A2.js new file mode 100644 index 000000000..e5bf5f325 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4.4_A2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Error.prototype.toString returns an implementation defined string + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4.4_A2.js + * @description Checking if call of Error.prototype.toSting() fails + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +var err1=new Error("Error"); +try{ + var toStr=err1.toString(); +} +catch(e){ + $ERROR('#1: var err1=new Error("Error"); var toStr=err1.toString(); lead to throwing exception. Exception is '+e); +} +if (toStr===undefined) { + $ERROR('#2: var err1=new Error("Error"); var toStr=err1.toString(); toStr!==undefined. Actual: '+toStr); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4_A1.js b/test/suite/ch15/15.11/15.11.4/S15.11.4_A1.js new file mode 100644 index 000000000..db677f0dc --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4_A1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The value of the internal [[Prototype]] property of the Error prototype object is the Object prototype + * object(15.2.3.1) + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4_A1.js + * @description Get Error.prototype and compare with Object.prototype + */ + +////////////////////////////////////////////////////////////////////////////// +// CHECK#1 +if (!Object.prototype.isPrototypeOf(Error.prototype)) { + $ERROR('#1: Object.prototype.isPrototypeOf(Error.prototype) return true. Actual: '+Object.prototype.isPrototypeOf(Error.prototype)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4_A2.js b/test/suite/ch15/15.11/15.11.4/S15.11.4_A2.js new file mode 100644 index 000000000..34ba827d8 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4_A2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The value of the internal [[Class]] property of Error prototype object is "Error" + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4_A2.js + * @description Getting the value of the internal [[Class]] property using Error.prototype.toString() function + */ + +Error.prototype.toString=Object.prototype.toString; +__tostr = Error.prototype.toString(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__tostr !== "[object Error]") { + $ERROR('#1: Error.prototype.toString=Object.prototype.toString; __tostr = Error.prototype.toString(); __tostr === "[object Error]". Actual: '+__tostr ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4_A3.js b/test/suite/ch15/15.11/15.11.4/S15.11.4_A3.js new file mode 100644 index 000000000..2b29d0cf6 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4_A3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since Error prototype object is not function it has not [[call]] method + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4_A3.js + * @description Checking if call of Error prototype as a function fails + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + Error.prototype(); + $FAIL('#1: "Error.prototype()" lead to throwing exception'); +} catch (e) {} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch15/15.11/15.11.4/S15.11.4_A4.js b/test/suite/ch15/15.11/15.11.4/S15.11.4_A4.js new file mode 100644 index 000000000..de91ea387 --- /dev/null +++ b/test/suite/ch15/15.11/15.11.4/S15.11.4_A4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since Error prototype object is not function it has not [[create]] method + * + * @path 15_Native/15.11_Error_Objects/15.11.4_Properties_of_the_Error_Prototype_Object/S15.11.4_A4.js + * @description Checking if creating "new Error.prototype" fails + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + __instance = new Object.prototype; + $FAIL('#1: "__instance = new Object.prototype" lead to throwing exception'); +} catch (e) {} +// +////////////////////////////////////////////////////////////////////////////// + |