diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch08/8.6 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch08/8.6')
25 files changed, 596 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A1.js b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A1.js new file mode 100644 index 000000000..df5609b38 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property can have attribute ReadOnly like E in Math + * + * @path ch08/8.6/8.6.1/S8.6.1_A1.js + * @description Try change Math.E property + * @noStrict + */ + +var __e = Math.E; +Math.E=1; +if (Math.E !==__e){ + $ERROR('#1: __e = Math.E; Math.E=1; Math.E ===__e'); +} + diff --git a/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A2.js b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A2.js new file mode 100644 index 000000000..c8fe932c5 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property can have attribute DontEnum like all properties of Number + * + * @path ch08/8.6/8.6.1/S8.6.1_A2.js + * @description Try to enumerate properties of Number + */ + +//CHECK#1 +var count=0; +for (p in Number) count++; +if (count > 0){ + $ERROR('#1: count=0; for (p in Number) count++; count > 0. Actual: ' + (count)); +} + diff --git a/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A3.js b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A3.js new file mode 100644 index 000000000..099dc46c9 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.1/S8.6.1_A3.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. + +/** + * A property can have attribute DontDelete like NaN propertie of Number object + * + * @path ch08/8.6/8.6.1/S8.6.1_A3.js + * @description Try to delete Number.NaN + * @noStrict + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete Number.NaN !== false){ + $ERROR('#1: delete Number.NaN === false. Actual: ' + (delete Number.NaN)); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof(Number.NaN) === "undefined"){ + $ERROR('#2: delete Number.NaN; typeof(Number.NaN) !== "undefined" '); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.1/browser.js b/js/src/tests/test262/ch08/8.6/8.6.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.1/browser.js diff --git a/js/src/tests/test262/ch08/8.6/8.6.1/shell.js b/js/src/tests/test262/ch08/8.6/8.6.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.1/shell.js diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A1.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A1.js new file mode 100644 index 000000000..371d16848 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A1.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Native ECMAScript objects have an internal property called [[Prototype]]. The value of this property is + * either null or an object and is used for implementing inheritance + * + * @path ch08/8.6/8.6.2/S8.6.2_A1.js + * @description Check [[Prototype]] property of object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var __obj={}; +if (!Object.prototype.isPrototypeOf(__obj)){ + $ERROR('#1: Native ECMAScript objects have an internal property called [[Prototype]]. '); +}; +// +////////////////////////////////////////////////////////////////////////////// + +//Establish proto (base) object +/*function ProtoObj(){ + +};*/ +var protoObj={}; +//Establish foo object +function FooObj(){}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +// Invoke instance of foo object +var obj__= new FooObj; + +if (!Object.prototype.isPrototypeOf(obj__)){ + $ERROR('#2.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; Object.prototype.isPrototypeOf(obj__) === true. Actual: ' + (Object.prototype.isPrototypeOf(obj__))); +}; + +if (!FooObj.prototype.isPrototypeOf(obj__)){ + $ERROR('#2.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype.isPrototypeOf(obj__) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(obj__))); +}; + +if (protoObj.isPrototypeOf(obj__)){ + $ERROR('#2.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); +}; +// Establish inheritance from proto object +FooObj.prototype=protoObj; + +if (protoObj.isPrototypeOf(obj__)){ + $ERROR('#2.4: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; protoObj.isPrototypeOf(obj__) === false. Actual: ' + (protoObj.isPrototypeOf(obj__))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 + +// Invoke instance of foo object +var __foo=new FooObj; + +if (!Object.prototype.isPrototypeOf(__foo)){ + $ERROR('#3.1: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; Object.prototype.isPrototypeOf(__foo) === true. Actual: ' + (Object.prototype.isPrototypeOf(__foo))); +}; + +if (!FooObj.prototype.isPrototypeOf(__foo)){ + $ERROR('#3.2: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; FooObj.prototype.isPrototypeOf(__foo) === true. Actual: ' + (FooObj.prototype.isPrototypeOf(__foo))); +}; + +if (!protoObj.isPrototypeOf(__foo)){ + $ERROR('#3.3: protoObj={}; function FooObj(){}; var obj__= new FooObj; FooObj.prototype=protoObj; var __foo=new FooObj; protoObj.isPrototypeOf(__foo) === true. Actual: ' + (protoObj.isPrototypeOf(__foo))); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A2.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A2.js new file mode 100644 index 000000000..5d4ccbd3e --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Properties of the [[Prototype]] object + * are visible as properties of the child object for the purposes of get access, but not for put access + * + * @path ch08/8.6/8.6.2/S8.6.2_A2.js + * @description Check visibility properties of the child object for the purposes of get access, but not for put access + */ + +//Establish foo object +function FooObj(){}; +FooObj.prototype.prop="some"; + +// Invoke instance of foo object +var foo= new FooObj; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (foo.prop !== "some"){ + $ERROR('#1: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop === "some". Actual: ' + (foo.prop)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +foo.prop=true; +// Invoke another instance of foo object +var foo__ = new FooObj; +if (foo__.prop !== "some"){ + $ERROR('#2: function FooObj(){}; FooObj.prototype.prop="some"; var foo= new FooObj; foo.prop=true; var foo__ = new FooObj; foo__.prop === "some". Actual: ' + (foo__.prop)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A3.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A3.js new file mode 100644 index 000000000..506471148 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_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. + +/** + * The specification does not provide any means for a program to access [[class]] value except through Object.prototype.toString + * + * @path ch08/8.6/8.6.2/S8.6.2_A3.js + * @description Get [[class]] value except through Object.prototype.toString + */ + +var __obj={}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.toString() !== "[object " + 'Object' + "]"){ + $ERROR('#1: var __obj={}; __obj.toString() === "[object " + \'Object\' + "]". Actual: ' + (__obj.toString())); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A4.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A4.js new file mode 100644 index 000000000..f147e6aaa --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A4.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * [[HasInstance]] returns a boolean value indicating whether Value delegates behaviour to this object + * + * @path ch08/8.6/8.6.2/S8.6.2_A4.js + * @description Check that the obj instance of Object, but not instance + * of Function, String, Number, Array + */ + +var __obj={}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__obj instanceof Object)) { + $ERROR('#1: var __obj={}; (__obj instanceof Object) === true. Actual: ' + ((__obj instanceof Object))); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj instanceof Function) { + $ERROR('#2: var __obj={}; (__obj instanceof Function) === false. Actual: ' + ((__obj instanceof Function))); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__obj instanceof String) { + $ERROR('#3: var __obj={}; (__obj instanceof String) === false. Actual: ' + ((__obj instanceof String))); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__obj instanceof Number) { + $ERROR('#4: var __obj={}; (__obj instanceof Number) === false. Actual: ' + ((__obj instanceof Number))); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__obj instanceof Array) { + $ERROR('#5: var __obj={}; (__obj instanceof Array) === false. Actual: ' + ((__obj instanceof Array))); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T1.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T1.js new file mode 100644 index 000000000..47fa0ef6f --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T1.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. + +/** + * [[Call]] executes code associated with the object + * + * @path ch08/8.6/8.6.2/S8.6.2_A5_T1.js + * @description Call function-property of object, property defined + * as testScreen = {touch:function(){count++}} + */ + +this.count=0; + +var testScreen = {touch:function(){count++}}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +testScreen.touch(); +if (count !==1) { + $ERROR('#1: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); count === 1. Actual: ' + (count)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +testScreen['touch'](); +if (count !==2) { + $ERROR('#2: this.count=0; testScreen = {touch:function(){count++}}; testScreen.touch(); testScreen[\'touch\'](); count === 2. Actual: ' + (count)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T2.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T2.js new file mode 100644 index 000000000..391122473 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_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. + +/** + * [[Call]] executes code associated with the object + * + * @path ch08/8.6/8.6.2/S8.6.2_A5_T2.js + * @description Call function-property of object, property defined + * as seat['move']=function(){position++} + */ + +this.position=0; +var seat = {}; +seat['move']=function(){position++}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +seat.move(); +if (position !==1) { + $ERROR('#1: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); position === 1. Actual: ' + (position)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +seat['move'](); +if (position !==2) { + $ERROR('#2: this.position=0; seat = {}; seat[\'move\']=function(){position++}; seat.move(); seat[\'move\'](); position === 2. Actual: ' + (position)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T3.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T3.js new file mode 100644 index 000000000..bbd603e4c --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * [[Call]] executes code associated with the object + * + * @path ch08/8.6/8.6.2/S8.6.2_A5_T3.js + * @description Call function-property of global object, property defined + * as knock=function(){count++} + */ + +var count=0; +var knock=function(){count++}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +knock(); +if (count !==1) { + $ERROR('#1: count=0; knock=function(){count++}; knock(); count === 1. Actual: ' + (count)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +this['knock'](); +if (count !==2) { + $ERROR('#2: count=0; knock=function(){count++}; knock(); this[\'knock\'](); count === 2. Actual: ' + (count)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T4.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T4.js new file mode 100644 index 000000000..7f38b27a0 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A5_T4.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. + +/** + * [[Call]] executes code associated with the object + * + * @path ch08/8.6/8.6.2/S8.6.2_A5_T4.js + * @description Call function-property of global object, property defined + * as this['beep']=function(){__count++} + */ + +var __count=0; + +this["beep"]=function(){__count++}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +beep(); +if (__count !==1) { + $ERROR('#1: __count=0; this["beep"]=function(){__count++}; beep(); __count === 1. Actual: ' + (__count)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +this["beep"](); +if (__count !==2) { + $ERROR('#2: __count=0; this["beep"]=function(){__count++}; beep(); this["beep"](); __count === 2. Actual: ' + (__count)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A6.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A6.js new file mode 100644 index 000000000..d62d34b47 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A6.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * [[Construct]] constructs an object. Invoked via the new operator. Objects that implement this internal method are called constructors + * + * @path ch08/8.6/8.6.2/S8.6.2_A6.js + * @description Create a few Objects via the new operator + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var objInstance=new Object; +if (objInstance.constructor !== Object){ + $ERROR('#1: var objInstance=new Object; objInstance.constructor === Object. Actual: ' + (objInstance.constructor)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var numInstance=new Number; +if (numInstance.constructor !== Number){ + $ERROR('#2: var numInstance=new Number; numInstance.constructor === Number. Actual: ' + (numInstance.constructor)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A7.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A7.js new file mode 100644 index 000000000..6e996d779 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A7.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Objects that implement internal method [[Construct]] are called constructors. Math object is NOT constructor + * + * @path ch08/8.6/8.6.2/S8.6.2_A7.js + * @description Checking if execution of "var objMath=new Math" passes + * @negative + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +var objMath=new Math; + +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A8.js b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A8.js new file mode 100644 index 000000000..d57a56132 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A8.js @@ -0,0 +1,22 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path ch08/8.6/8.6.2/S8.6.2_A8.js + * @description It should not be possible to change the [[Prototype]] + * of a non-extensible object + */ + +var x = Object.preventExtensions({}); +var y = {}; +try { + x.__proto__ = y; +} catch (err) { + // As far as this test is concerned, we allow the above assignment + // to fail. This failure does violate the spec and should probably + // be tested separately. +} +if (Object.getPrototypeOf(x) !== Object.prototype) { + $ERROR("Prototype of non-extensible object mutated"); +} + diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/browser.js b/js/src/tests/test262/ch08/8.6/8.6.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/browser.js diff --git a/js/src/tests/test262/ch08/8.6/8.6.2/shell.js b/js/src/tests/test262/ch08/8.6/8.6.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/8.6.2/shell.js diff --git a/js/src/tests/test262/ch08/8.6/S8.6_A2_T1.js b/js/src/tests/test262/ch08/8.6/S8.6_A2_T1.js new file mode 100644 index 000000000..4e13df667 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/S8.6_A2_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Do not crash with postincrement custom property + * + * @path ch08/8.6/S8.6_A2_T1.js + * @description Try to implement postincrement for custom property + */ + +var __map={foo:"bar"}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 + +__map.foo++; +if (!isNaN(__map.foo)) { + $ERROR('#1: var __map={foo:"bar"}; __map.foo++; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); +} + +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/S8.6_A2_T2.js b/js/src/tests/test262/ch08/8.6/S8.6_A2_T2.js new file mode 100644 index 000000000..b96be42ad --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/S8.6_A2_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Do not crash with postincrement custom property + * + * @path ch08/8.6/S8.6_A2_T2.js + * @description Try to implement postincrement for not declared custom property + */ + +var __map={}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!isNaN(__map.foo++)) { + $ERROR('#1: var __map={}; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!("foo" in __map)) { + $ERROR('#2: var __map={}; "foo" in __map'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/S8.6_A3_T1.js b/js/src/tests/test262/ch08/8.6/S8.6_A3_T1.js new file mode 100644 index 000000000..431148520 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/S8.6_A3_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Do not crash with pefixincrement custom property + * + * @path ch08/8.6/S8.6_A3_T1.js + * @description Try to implement pefixincrement for custom property + */ + +var __map={foo:'bar'}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 + +++__map.foo; +if (!isNaN(__map.foo)) { + $ERROR('#1: var __map={foo:"bar"}; ++__map.foo; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); +} + +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/S8.6_A3_T2.js b/js/src/tests/test262/ch08/8.6/S8.6_A3_T2.js new file mode 100644 index 000000000..08a425a13 --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/S8.6_A3_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Do not crash with pefixincrement custom property + * + * @path ch08/8.6/S8.6_A3_T2.js + * @description Try to implement pefixincrement for not declared custom property + */ + +var __map={}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!isNaN(++__map.foo)) { + $ERROR('#1: var __map={}; __map.foo++; __map.foo === Not-a-Number. Actual: ' + (__map.foo)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!("foo" in __map)) { + $ERROR('#2: var __map={}; "foo" in __map'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/S8.6_A4_T1.js b/js/src/tests/test262/ch08/8.6/S8.6_A4_T1.js new file mode 100644 index 000000000..94424118a --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/S8.6_A4_T1.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * An Object is an unordered collection of properties + * + * @path ch08/8.6/S8.6_A4_T1.js + * @description Simple using a few custom properties + */ + +/////////////////////////////////////////////////////// +// CHECK#1 +var obj = {bar:true, some:1, foo:"a"}; + +var count=0; + +for (property in obj) count++; + +if (count !== 3){ + $ERROR('#1: obj = {bar:true, some:1, foo:"a"}; count=0; for (property in obj) count++; count === 3. Actual: ' + (count)); +} +// +//////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// CHECK#2 +var obj_ = {bar:true}; +obj_.some = 1; +obj_.foo = "a"; + +count=0; + +for (property in obj_) count++; + +if (count !== 3){ + $ERROR('#2: obj_ = {bar:true}; obj_.some = 1; obj_.foo = "a"; count=0; for (property in obj_) count++; count === 3. Actual: ' + (count)); +} +// +//////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// CHECK#3 +var obj__ = new Object(); +obj__.bar = true; +obj__.some = 1; +obj__.foo = "a"; + +count=0; + +for (property in obj__) count++; + +if (count !== 3){ + $ERROR('#3: obj__ = new Object(); obj__.bar = true; obj__.some = 1; obj__.foo = "a"; for (property in obj__) count++; count === 3. Actual: ' + (count)); +} +// +//////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.6/browser.js b/js/src/tests/test262/ch08/8.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/browser.js diff --git a/js/src/tests/test262/ch08/8.6/shell.js b/js/src/tests/test262/ch08/8.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.6/shell.js |