diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor')
20 files changed, 869 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T1.js new file mode 100644 index 000000000..be97738ae --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T1; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with expression "new String"; +*/ + +var __str = new String; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String; typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String; __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str != "") { + $ERROR('#2: __str = new String; __str == "". Actual: __str =='+__str); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ( __str === "") { + $ERROR('#3: __str = new String; __str !== ""'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T10.js new file mode 100644 index 000000000..53b9f8fc8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T10.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. + +/** +* @name: S15.5.2.1_A1_T10; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function object)" as the function object's prototype.toString property was changed; +*/ + +function __FACTORY(){}; + +__FACTORY.prototype.toString=function(){return "tostr"}; + +var __obj = new __FACTORY; + +var __str = new String(__obj); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(__obj); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(__obj); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str != "tostr") { + $ERROR('#2: __str = new String(__obj); __str =="tostr". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T11.js new file mode 100644 index 000000000..64b25437a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T11.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T11; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function object)" after changing function object's valueOf and toString properties; +*/ + +function __obj(){}; + +__obj.valueOf=function(){return true;}; + +__obj.toString=function(){return {};}; + +var __str = new String(__obj); + + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: function __obj(){}; __str = new String(__obj); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(__obj); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="true") { + $ERROR('#2: function __obj(){}; __str = new String(__obj); __str =="true". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T12.js new file mode 100644 index 000000000..480fd2d61 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T12.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T12; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function object)", after changing the function object toString property, which causes exception throw; +*/ + +var __obj = {toString:function(){throw "intostr"}}; + +__obj.valueOf=function(){return true}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var __str = new String(__obj); + $ERROR('#1: var __obj = {toString:function(){throw "intostr"}}; __str = new String(__obj) lead throwing exception'); +} catch (e) { + if (e!=="intostr") { + $ERROR('#1.1: e==="intostr". Actual: e==='+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T13.js new file mode 100644 index 000000000..986c24bb5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T13.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T13; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function object)" after changing function object's valueOf property, which causes exception throw; +*/ + +var __obj = {toString:function(){return f; function f(){}}}; + +__obj.valueOf=function(){throw "invalueof"}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try { + var __str = new String(__obj); + $ERROR('#1: __obj.valueOf=function(){throw "invalueof"}; __str = new String(__obj) lead throwing exception'); +} catch (e) { + if (e!=="invalueof") { + $ERROR('#1.1: e==="invalueof". Actual: e==='+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T16.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T16.js new file mode 100644 index 000000000..96780715b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T16.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T16; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String()" initialized with .12345 and other numbers; +*/ + +__str =new String(.12345); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str =new String(.12345); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str =new String(.12345); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="0.12345") { + $ERROR('#2: __str =new String(.12345); __str =="0.12345". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str =new String(.012345); +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __str !== "object") { + $ERROR('#3: __str =new String(.012345); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2.5 +if (__str.constructor !== String) { + $ERROR('#3.5: __str =new String(.012345); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__str !="0.012345") { + $ERROR('#4: __str =new String(.012345); __str =="0.012345". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str =new String(.0012345); +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof __str !== "object") { + $ERROR('#5: __str =new String(.0012345); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5.5 +if (__str.constructor !== String) { + $ERROR('#5.5: __str =new String(.0012345); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if (__str !="0.0012345") { + $ERROR('#6: __str =new String(.0012345); __str =="0.0012345". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str =new String(.00000012345); +////////////////////////////////////////////////////////////////////////////// +//CHECK#7 +if (typeof __str !== "object") { + $ERROR('#7: __str =new String(.00000012345); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#7.5 +if (__str.constructor !== String) { + $ERROR('#7.5: __str =new String(.00000012345); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#8 +if (__str !="1.2345e-7") { + $ERROR('#8: __str =new String(.00000012345); __str =="1.2345e-7". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T17.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T17.js new file mode 100644 index 000000000..444dbd5c3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T17.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T17; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String()" initialized with numbers that have more than 1 significant digit following the point; +*/ + +var __str = new String(1.2345); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(1.2345); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(1.2345); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="1.2345") { + $ERROR('#2: __str = new String(1.2345); __str =="1.2345". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str = new String(1.234567890); +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __str !== "object") { + $ERROR('#3: __str = new String(1.234567890); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3.5 +if (__str.constructor !== String) { + $ERROR('#3.5: __str = new String(1.234567890); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__str !="1.23456789") { + $ERROR('#4: __str = new String(1.234567890); __str =="1.23456789". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str = new String(1.234500000000000000000000000); +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof __str !== "object") { + $ERROR('#5: __str = new String(1.234500000000000000000000000); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5.5 +if (__str.constructor !== String) { + $ERROR('#5.5: __str = new String(1.234500000000000000000000000); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if (__str !="1.2345") { + $ERROR('#6: __str = new String(1.234500000000000000000000000); __str =="1.2345". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T18.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T18.js new file mode 100644 index 000000000..eaceca2c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T18.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T18; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Create string object with "new String()" initialized with numbers that have more than 1 significant digit; +*/ + +var __str = new String(1000000000000000000000); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(1000000000000000000000); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(1000000000000000000000); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="1e+21") { + $ERROR('#2: __str = new String(1000000000000000000000); __str =="1e+21". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +__str = new String(10000000000000000000000); +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __str !== "object") { + $ERROR('#3: __str = new String(10000000000000000000000); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3.5 +if (__str.constructor !== String) { + $ERROR('#3.5: __str = new String(10000000000000000000000); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__str !="1e+22") { + $ERROR('#4: __str = new String(10000000000000000000000); __str =="1e+22". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T19.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T19.js new file mode 100644 index 000000000..1d3ac0ac3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T19.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T19; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String()" initialized with Array of numbers; +*/ + +var __str = new String(new Array(1,2,3)); +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(new Array(1,2,3)); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(new Array(1,2,3)); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="1,2,3") { + $ERROR('#2: __str = new String(new Array(1,2,3)); __str =="1,2,3". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T2.js new file mode 100644 index 000000000..33dc75bfe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T2; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String()"; +*/ + +var __str = new String(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="") { + $ERROR('#2: __str = new String(); __str =="". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ( __str === "") { + $ERROR('#3: __str = new String(); __str !== ""'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T3.js new file mode 100644 index 000000000..2b72cf7cd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T3.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T3; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String("")"; +*/ + +var __str = new String(""); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(""); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(""); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="") { + $ERROR('#2: __str = new String(""); __str =="". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if ( __str === "") { + $ERROR('#3: __str = new String(""); __str !== ""'); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T4.js new file mode 100644 index 000000000..1bcc7eacf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T4; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Create string object with "new String(1.0)"; +*/ + +var __str = new String(1.0); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(1.0); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(1.0); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !=1.0+"") { + $ERROR('#2: __str = new String(1.0); __str ==1.0+"". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T5.js new file mode 100644 index 000000000..12565a42e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T5.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T5; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(NaN)"; +*/ + +var __str = new String(NaN); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(NaN); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(NaN); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !=(1/"s")+"") { + $ERROR('#2: __str = new String(NaN); __str ==(1/"s")+"". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T6.js new file mode 100644 index 000000000..9f261ade9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T6.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T6; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(false)"; +*/ + +var __str = new String(false); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(false); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(false); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !=false+"") { + $ERROR('#2: __str = new String(false); __str ==false+"". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T7.js new file mode 100644 index 000000000..1d7a32039 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T7.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. + +/** +* @name: S15.5.2.1_A1_T7; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String({})"; +*/ + +var __stored__Object__prototype__toString = Object.prototype.toString; + +Object.prototype.toString=function(){return "SHIFTED"}; + +var __str = new String({}); + +Object.prototype.toString = __stored__Object__prototype__toString; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String({}); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String({}); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="SHIFTED") { + $ERROR('#2: Object.prototype.toString=function(){return "SHIFTED"}; __str = new String({}); __str =="SHIFTED". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T8.js new file mode 100644 index 000000000..84b20201d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T8.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. + +/** +* @name: S15.5.2.1_A1_T8; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function(){})"; +*/ + +var __stored__Function__prototype__toString = Function.prototype.toString; + +Function.prototype.toString=function(){return "SHIFTED"}; + +var __str = new String(function(){}); + +Function.prototype.toString = __stored__Function__prototype__toString; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(function(){}); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(function(){}); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="SHIFTED") { + $ERROR('#2: Function.prototype.toString=function(){return "SHIFTED"}; __str = new String(function(){}); __str =="SHIFTED". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T9.js new file mode 100644 index 000000000..2eb4a344d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A1_T9.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A1_T9; +* @section: 15.5.2.1; +* @assertion: When "String" is called as part of a new expression, it is a constructor: it initialises the newly created object and +* The [[Value]] property of the newly constructed object is set to ToString(value), or to the empty string if value is not supplied; +* @description: Creating string object with "new String(function(){return [1,2,3]}())"; +*/ + +var __str = new String(function(){return [1,2,3]}()); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __str !== "object") { + $ERROR('#1: __str = new String(function(){return [1,2,3]}()); typeof __str === "object". Actual: typeof __str ==='+typeof __str ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1.5 +if (__str.constructor !== String) { + $ERROR('#1.5: __str = new String(function(){return [1,2,3]}()); __str.constructor === String. Actual: __str.constructor ==='+__str.constructor ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str !="1,2,3") { + $ERROR('#2: __str = new String(function(){return [1,2,3]}()); __str =="1,2,3". Actual: __str =='+__str ); +} +// +////////////////////////////////////////////////////////////////////////////// diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_T1.js new file mode 100644 index 000000000..294e779bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_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. + +/** +* @name: S15.5.2.1_A2_T1; +* @section: 15.5.2.1, 15.5.3.1; +* @assertion: The [[Prototype]] property of the newly constructed object is set to the original String prototype object; +* @description: Creating string object with "new String(string)" to check prototype; +*/ + +var __str__obj = new String("abba"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(String.prototype.isPrototypeOf(__str__obj))) { + $ERROR('#1: var __str__obj = new String("abba"); String.prototype.isPrototypeOf(__str__obj)===true'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_T2.js new file mode 100644 index 000000000..13042ea65 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A2_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A2_T2; +* @section: 15.5.2.1, 15.5.3.1; +* @assertion: The [[Prototype]] property of the newly constructed object is set to the original String prototype object; +* @description: Creating string object with "new String(string)" adding custom property; +*/ + + +var __str__obj = new String("shocking blue"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str__obj["__custom__prop"]!==undefined) { + $ERROR('#1: var __str__obj = new String("shocking blue"); __str__obj["__custom__prop"]===undefined. Actual: __str__obj["__custom__prop"]==='+__str__obj["__custom__prop"]); +} +// +////////////////////////////////////////////////////////////////////////////// + +String.prototype.__custom__prop = "bor"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__str__obj["__custom__prop"]!=="bor") { + $ERROR('#2: var __str__obj = new String("shocking blue"); String.prototype.__custom__prop = "bor"; __str__obj["__custom__prop"]==="bor". Actual: __str__obj["__custom__prop"]==='+__str__obj["__custom__prop"]); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A3.js new file mode 100644 index 000000000..2bab8a990 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.5_String_Objects/15.5.2_The_String_Constructor/S15.5.2.1_A3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.2.1_A3; +* @section: 15.5.2.1; +* @assertion: The [[Class]] property of the newly constructed object is set to "String"; +* @description: Creating string object with "new String(string)" and changing toString property to Object.prototype.toString; +*/ + +var __str__obj = new String("seamaid"); + +__str__obj.toString = Object.prototype.toString; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__str__obj.toString() !== "[object "+"String"+"]") { + $ERROR('#1: var __str__obj = new String("seamaid"); __str__obj.toString = Object.prototype.toString; __str__obj.toString() === "[object String]". Actual: __str__obj.toString() ==='+__str__obj.toString() ); +} +// +////////////////////////////////////////////////////////////////////////////// + |