diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Function/length')
15 files changed, 329 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Function/length/15.3.3.2-1.js b/js/src/tests/test262/built-ins/Function/length/15.3.3.2-1.js new file mode 100644 index 0000000000..92352d538d --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/15.3.3.2-1.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.3.3.2-1 +description: Function.length - data property with value 1 +---*/ + +var desc = Object.getOwnPropertyDescriptor(Function, "length"); + +assert.sameValue(desc.value, 1, 'desc.value'); +assert.sameValue(desc.writable, false, 'desc.writable'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T1.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T1.js new file mode 100644 index 0000000000..25a578ed6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T1.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. + +/*--- +info: | + The value of the length property is usually an integer that indicates the + 'typical' number of arguments expected by the function +es5id: 15.3.5.1_A1_T1 +description: Checking length property of Function("arg1,arg2,arg3", null) +---*/ + +var f = new Function("arg1,arg2,arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 3, 'The value of f.length is expected to be 3'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T2.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T2.js new file mode 100644 index 0000000000..2f92fd4b70 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T2.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. + +/*--- +info: | + The value of the length property is usually an integer that indicates the + 'typical' number of arguments expected by the function +es5id: 15.3.5.1_A1_T2 +description: > + Checking length property of Function("arg1,arg2,arg3","arg4,arg5", + null) +---*/ + +var f = Function("arg1,arg2,arg3", "arg4,arg5", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 5, 'The value of f.length is expected to be 5'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T3.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T3.js new file mode 100644 index 0000000000..75bb201363 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A1_T3.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. + +/*--- +info: | + The value of the length property is usually an integer that indicates the + 'typical' number of arguments expected by the function +es5id: 15.3.5.1_A1_T3 +description: > + Checking length property of + Function("arg1,arg2,arg3","arg1,arg2","arg3", null) +---*/ + +var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert.sameValue(f.length, 6, 'The value of f.length is expected to be 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T1.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T1.js new file mode 100644 index 0000000000..9950b42dae --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.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. + +/*--- +info: the length property does not have the attributes { DontDelete } +es5id: 15.3.5.1_A2_T1 +description: > + Checking if deleting the length property of + Function("arg1,arg2,arg3", null) succeeds +---*/ + +var f = new Function("arg1,arg2,arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); +assert(delete f.length, 'The value of delete f.length is expected to be true'); +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 3, 'The value of f.length is not 3'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T2.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T2.js new file mode 100644 index 0000000000..0eeb054a2d --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T2.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. + +/*--- +info: the length property does not have the attributes { DontDelete } +es5id: 15.3.5.1_A2_T2 +description: > + Checking if deleting the length property of + Function("arg1,arg2,arg3","arg4,arg5", null) succeeds +---*/ + +var f = Function("arg1,arg2,arg3", "arg4,arg5", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); + +delete f.length; + +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 5, 'The value of f.length is not 5'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T3.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T3.js new file mode 100644 index 0000000000..2bb421ab95 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A2_T3.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. + +/*--- +info: the length property does not have the attributes { DontDelete } +es5id: 15.3.5.1_A2_T3 +description: > + Checking if deleting the length property of + Function("arg1,arg2,arg3","arg1,arg2","arg3", null) succeeds +---*/ + +var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); + +delete f.length; + +assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true'); +assert.notSameValue(f.length, 6, 'The value of f.length is not 6'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T1.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T1.js new file mode 100644 index 0000000000..0730211a22 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: the length property has the attributes { ReadOnly } +es5id: 15.3.5.1_A3_T1 +description: > + Checking if varying the length property of + Function("arg1,arg2,arg3","arg4,arg5", null) fails +includes: [propertyHelper.js] +---*/ + +var f = new Function("arg1,arg2,arg3", "arg4,arg5", null); + +assert(f.hasOwnProperty('length')); + +var flength = f.length; + +verifyNotWritable(f, "length", null, function() {}); + +assert.sameValue(f.length, flength); + +try { + f.length(); + throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + if (e instanceof Test262Error) { + throw e; + } +} + +if (f.length !== 5) { + throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T2.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T2.js new file mode 100644 index 0000000000..e98b6827bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: the length property has the attributes { ReadOnly } +es5id: 15.3.5.1_A3_T2 +description: > + Checking if varying the length property of + Function("arg1,arg2,arg3", null) fails +includes: [propertyHelper.js] +---*/ + +var f = Function("arg1,arg2,arg3", null); + +assert(f.hasOwnProperty('length')); + +var flength = f.length; + +verifyNotWritable(f, "length", null, function() {}); + +assert.sameValue(f.length, flength); + +try { + f.length(); + throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + if (e instanceof Test262Error) { + throw e; + } +} + +if (f.length !== 3) { + throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T3.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T3.js new file mode 100644 index 0000000000..99ccfd2c31 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A3_T3.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: the length property has the attributes { ReadOnly } +es5id: 15.3.5.1_A3_T3 +description: > + Checking if varying the length property of + Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails +includes: [propertyHelper.js] +---*/ + +var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); + +assert(f.hasOwnProperty('length')); + +var flength = f.length; + +verifyNotWritable(f, "length", null, function() {}); + +assert.sameValue(f.length, flength); + +try { + f.length(); + throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + if (e instanceof Test262Error) { + throw e; + } +} + +if (f.length !== 6) { + throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); +} + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T1.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T1.js new file mode 100644 index 0000000000..bc4d7d1a49 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T1.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. + +/*--- +info: the length property has the attributes { DontEnum } +es5id: 15.3.5.1_A4_T1 +description: > + Checking if enumerating the length property of + Function("arg1,arg2,arg3", null) fails +---*/ + +var f = new Function("arg1,arg2,arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); + +for (var key in f) { + if (key == "length") { + var lengthenumed = true; + } +} +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T2.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T2.js new file mode 100644 index 0000000000..25ae5037e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: the length property has the attributes { DontEnum } +es5id: 15.3.5.1_A4_T2 +description: > + Checking if enumerating the length property of + Function("arg1,arg2,arg3","arg4,arg5", null) fails +---*/ + +var f = Function("arg1,arg2,arg3", "arg5,arg4", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); + +for (var key in f) { + if (key == "length") { + var lengthenumed = true; + } +} + +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T3.js b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T3.js new file mode 100644 index 0000000000..a0f6255fc7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/S15.3.5.1_A4_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: the length property has the attributes { DontEnum } +es5id: 15.3.5.1_A4_T3 +description: > + Checking if enumerating the length property of + Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails +---*/ + +var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); + +assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true'); + +for (var key in f) { + if (key == "length") { + var lengthenumed = true; + } +} + +assert(!lengthenumed, 'The value of !lengthenumed is expected to be true'); + +// TODO: Convert to verifyProperty() format. + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Function/length/browser.js b/js/src/tests/test262/built-ins/Function/length/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/browser.js diff --git a/js/src/tests/test262/built-ins/Function/length/shell.js b/js/src/tests/test262/built-ins/Function/length/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Function/length/shell.js |