diff --git a/test/built-ins/Object/prototype/toString/15.2.4.2-1-1.js b/test/built-ins/Object/prototype/toString/15.2.4.2-1-1.js deleted file mode 100644 index 801dfbaf69..0000000000 --- a/test/built-ins/Object/prototype/toString/15.2.4.2-1-1.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2-1-1 -description: > - Object.prototype.toString - '[object Undefined]' will be returned - when 'this' value is undefined ----*/ - -assert.sameValue(Object.prototype.toString.call(undefined), "[object Undefined]", 'Object.prototype.toString.call(undefined)'); diff --git a/test/built-ins/Object/prototype/toString/15.2.4.2-1-2.js b/test/built-ins/Object/prototype/toString/15.2.4.2-1-2.js deleted file mode 100644 index c6daf25000..0000000000 --- a/test/built-ins/Object/prototype/toString/15.2.4.2-1-2.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2-1-2 -description: > - Object.prototype.toString - '[object Undefined]' will be returned - when 'this' value is undefined ----*/ - -assert.sameValue(Object.prototype.toString.apply(undefined, []), "[object Undefined]", 'Object.prototype.toString.apply(undefined, [])'); diff --git a/test/built-ins/Object/prototype/toString/15.2.4.2-2-1.js b/test/built-ins/Object/prototype/toString/15.2.4.2-2-1.js deleted file mode 100644 index ee6120a79f..0000000000 --- a/test/built-ins/Object/prototype/toString/15.2.4.2-2-1.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2-2-1 -description: > - Object.prototype.toString - '[object Null]' will be returned when - 'this' value is null ----*/ - -assert.sameValue(Object.prototype.toString.call(null), "[object Null]", 'Object.prototype.toString.call(null)'); diff --git a/test/built-ins/Object/prototype/toString/15.2.4.2-2-2.js b/test/built-ins/Object/prototype/toString/15.2.4.2-2-2.js deleted file mode 100644 index 194597ab0b..0000000000 --- a/test/built-ins/Object/prototype/toString/15.2.4.2-2-2.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2-2-2 -description: > - Object.prototype.toString - '[object Null]' will be returned when - 'this' value is null ----*/ - -assert.sameValue(Object.prototype.toString.apply(null, []), "[object Null]", 'Object.prototype.toString.apply(null, [])'); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-arguments.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-arguments.js new file mode 100644 index 0000000000..4730f9be04 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-arguments.js @@ -0,0 +1,12 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has a [[ParameterMap]] internal slot, let builtinTag be "Arguments". +---*/ +assert.sameValue( + Object.prototype.toString.call(function() { return arguments; }()), + "[object Arguments]", + "Object.prototype.toString.call(function() { return arguments; }()) returns [object Arguments]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-array.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-array.js new file mode 100644 index 0000000000..a6656f711c --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-array.js @@ -0,0 +1,32 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: Let isArray be ? IsArray(O). If isArray is true, let builtinTag be "Array". +---*/ +assert.sameValue( + Object.prototype.toString.call([]), + "[object Array]", + "Object.prototype.toString.call([]) returns [object Array]" +); +assert.sameValue( + Object.prototype.toString.call(Object([])), + "[object Array]", + "Object.prototype.toString.call(Object([])) returns [object Array]" +); +assert.sameValue( + Object.prototype.toString.call(Array()), + "[object Array]", + "Object.prototype.toString.call(Array()) returns [object Array]" +); +assert.sameValue( + Object.prototype.toString.call(Object(Array())), + "[object Array]", + "Object.prototype.toString.call(Object(Array())) returns [object Array]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Array())), + "[object Array]", + "Object.prototype.toString.call(Object(new Array())) returns [object Array]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-bigint.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-bigint.js new file mode 100644 index 0000000000..67b0185675 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-bigint.js @@ -0,0 +1,14 @@ +// Copyright (C) 2017 Igalia, S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: BigInt.prototype[@@toStringTag] is BigInt +info: | + Let tag be ? Get(O, @@toStringTag). +features: [BigInt] +---*/ +assert.sameValue(Object.prototype.toString.call(3n), "[object BigInt]"); +assert.sameValue(Object.prototype.toString.call(Object(3n)), "[object BigInt]"); +assert.sameValue(Object.prototype.toString.call(BigInt(3n)), "[object BigInt]"); +assert.sameValue(Object.prototype.toString.call(Object(BigInt(3n))), "[object BigInt]"); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-boolean.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-boolean.js new file mode 100644 index 0000000000..53ddf01bce --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-boolean.js @@ -0,0 +1,37 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has a [[BooleanData]] internal slot, let builtinTag be "Boolean". +---*/ +assert.sameValue( + Object.prototype.toString.call(true), + "[object Boolean]", + "Object.prototype.toString.call(true) returns [object Boolean]" +); +assert.sameValue( + Object.prototype.toString.call(Object(true)), + "[object Boolean]", + "Object.prototype.toString.call(Object(true)) returns [object Boolean]" +); +assert.sameValue( + Object.prototype.toString.call(Boolean(true)), + "[object Boolean]", + "Object.prototype.toString.call(Boolean(true)) returns [object Boolean]" +); +assert.sameValue( + Object.prototype.toString.call(Object(Boolean(true))), + "[object Boolean]", + "Object.prototype.toString.call(Object(Boolean(true))) returns [object Boolean]" +); +assert.sameValue( + Object.prototype.toString.call(new Boolean(true)), + "[object Boolean]", + "Object.prototype.toString.call(new Boolean(true)) returns [object Boolean]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Boolean(true))), + "[object Boolean]", + "Object.prototype.toString.call(Object(new Boolean(true))) returns [object Boolean]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-date.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-date.js new file mode 100644 index 0000000000..a422075aa0 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-date.js @@ -0,0 +1,17 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: is a String exotic object, let builtinTag be "String". +---*/ +assert.sameValue( + Object.prototype.toString.call(new Date()), + "[object Date]", + "Object.prototype.toString.call(new Date()) returns [object Date]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Date())), + "[object Date]", + "Object.prototype.toString.call(Object(new Date())) returns [object Date]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-error.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-error.js new file mode 100644 index 0000000000..6e04eb7e60 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-error.js @@ -0,0 +1,27 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has an [[ErrorData]] internal slot, let builtinTag be "Error". +---*/ +assert.sameValue( + Object.prototype.toString.call(Error()), + "[object Error]", + "Object.prototype.toString.call(Error()) returns [object Error]" +); +assert.sameValue( + Object.prototype.toString.call(Object(Error())), + "[object Error]", + "Object.prototype.toString.call(Object(Error())) returns [object Error]" +); +assert.sameValue( + Object.prototype.toString.call(new Error()), + "[object Error]", + "Object.prototype.toString.call(new Error()) returns [object Error]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Error())), + "[object Error]", + "Object.prototype.toString.call(Object(new Error())) returns [object Error]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-function.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-function.js new file mode 100644 index 0000000000..8b749e060a --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-function.js @@ -0,0 +1,37 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has a [[Call]] internal method, let builtinTag be "Function". +---*/ +assert.sameValue( + Object.prototype.toString.call(function() {}), + "[object Function]", + "Object.prototype.toString.call(function() {}) returns [object Function]" +); +assert.sameValue( + Object.prototype.toString.call(Object(function() {})), + "[object Function]", + "Object.prototype.toString.call(Object(function() {})) returns [object Function]" +); +assert.sameValue( + Object.prototype.toString.call(Function()), + "[object Function]", + "Object.prototype.toString.call(Function()) returns [object Function]" +); +assert.sameValue( + Object.prototype.toString.call(Object(Function())), + "[object Function]", + "Object.prototype.toString.call(Object(Function())) returns [object Function]" +); +assert.sameValue( + Object.prototype.toString.call(new Function()), + "[object Function]", + "Object.prototype.toString.call(new Function()) returns [object Function]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Function())), + "[object Function]", + "Object.prototype.toString.call(Object(new Function())) returns [object Function]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-null.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-null.js new file mode 100644 index 0000000000..e4c4e4451e --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-null.js @@ -0,0 +1,12 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: If the this value is null, return "[object Null]". +---*/ +assert.sameValue( + Object.prototype.toString.call(null), + "[object Null]", + "Object.prototype.toString.call(null) returns [object Null]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-number.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-number.js new file mode 100644 index 0000000000..fb636ba3f8 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-number.js @@ -0,0 +1,37 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has a [[NumberData]] internal slot, let builtinTag be "Number" +---*/ +assert.sameValue( + Object.prototype.toString.call(9), + "[object Number]", + "Object.prototype.toString.call(9) returns [object Number]" +); +assert.sameValue( + Object.prototype.toString.call(Object(9)), + "[object Number]", + "Object.prototype.toString.call(Object(9)) returns [object Number]" +); +assert.sameValue( + Object.prototype.toString.call(Number(9)), + "[object Number]", + "Object.prototype.toString.call(Number(9)) returns [object Number]" +); +assert.sameValue( + Object.prototype.toString.call(Object(Number(9))), + "[object Number]", + "Object.prototype.toString.call(Object(Number(9))) returns [object Number]" +); +assert.sameValue( + Object.prototype.toString.call(new Number(9)), + "[object Number]", + "Object.prototype.toString.call(new Number(9)) returns [object Number]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new Number(9))), + "[object Number]", + "Object.prototype.toString.call(Object(new Number(9))) returns [object Number]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-object.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-object.js new file mode 100644 index 0000000000..39d7b06a8a --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-object.js @@ -0,0 +1,22 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: Else, let builtinTag be "Object". +---*/ +assert.sameValue( + Object.prototype.toString.call({}), + "[object Object]", + "Object.prototype.toString.call({}) returns [object Object]" +); +assert.sameValue( + Object.prototype.toString.call(Object({})), + "[object Object]", + "Object.prototype.toString.call(Object({})) returns [object Object]" +); +assert.sameValue( + Object.prototype.toString.call(new Object({})), + "[object Object]", + "Object.prototype.toString.call(new Object({})) returns [object Object]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-regexp.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-regexp.js new file mode 100644 index 0000000000..520d3aeaf3 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-regexp.js @@ -0,0 +1,27 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: has a [[RegExpMatcher]] internal slot, let builtinTag be "RegExp". +---*/ +assert.sameValue( + Object.prototype.toString.call(/./), + "[object RegExp]", + "Object.prototype.toString.call(/./) returns [object RegExp]" +); +assert.sameValue( + Object.prototype.toString.call(Object(/./)), + "[object RegExp]", + "Object.prototype.toString.call(Object(/./)) returns [object RegExp]" +); +assert.sameValue( + Object.prototype.toString.call(new RegExp()), + "[object RegExp]", + "Object.prototype.toString.call(new RegExp()) returns [object RegExp]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new RegExp())), + "[object RegExp]", + "Object.prototype.toString.call(Object(new RegExp())) returns [object RegExp]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-string.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-string.js new file mode 100644 index 0000000000..2f350e6674 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-string.js @@ -0,0 +1,37 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: is a String exotic object, let builtinTag be "String". +---*/ +assert.sameValue( + Object.prototype.toString.call(""), + "[object String]", + "Object.prototype.toString.call(\"\") returns [object String]" +); +assert.sameValue( + Object.prototype.toString.call(Object("")), + "[object String]", + "Object.prototype.toString.call(Object(\"\")) returns [object String]" +); +assert.sameValue( + Object.prototype.toString.call(String("")), + "[object String]", + "Object.prototype.toString.call(String(\"\")) returns [object String]" +); +assert.sameValue( + Object.prototype.toString.call(Object(String(""))), + "[object String]", + "Object.prototype.toString.call(Object(String(\"\"))) returns [object String]" +); +assert.sameValue( + Object.prototype.toString.call(new String("")), + "[object String]", + "Object.prototype.toString.call(new String(\"\")) returns [object String]" +); +assert.sameValue( + Object.prototype.toString.call(Object(new String(""))), + "[object String]", + "Object.prototype.toString.call(Object(new String(\"\"))) returns [object String]" +); diff --git a/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-undefined.js b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-undefined.js new file mode 100644 index 0000000000..84e99cca6e --- /dev/null +++ b/test/built-ins/Object/prototype/toString/Object.prototype.toString.call-undefined.js @@ -0,0 +1,12 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: If the this value is undefined, return "[object Undefined]". +---*/ +assert.sameValue( + Object.prototype.toString.call(undefined), + "[object Undefined]", + "Object.prototype.toString.call(undefined) returns [object Undefined]" +); diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A1.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A1.js deleted file mode 100644 index 6aee4b3306..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A1.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: | - When the toString method is called, the following steps are taken: - i) Get the [[Class]] property of this object - ii) Compute a string value by concatenating the three strings "[object ", Result(1), and "]" - iii) Return Result(2) -es5id: 15.2.4.2_A1 -description: > - Checking the type of Object.prototype.toString and the returned - result ----*/ - -//CHECK#1 -if (typeof Object.prototype.toString !== "function") { - $ERROR('#1: toString method defined'); -} - -//CHECK#2 -if (Object.prototype.toString() !== "[object " + "Object" + "]") { - $ERROR('#2: return a string value by concatenating the three strings "[object ", the [[Class]] property of this object, and "]"'); -} - -//CHECK#3 -if ({}.toString() !== "[object " + "Object" + "]") { - $ERROR('#3: return a string value by concatenating the three strings "[object ", the [[Class]] property of this object, and "]"'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A10.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A10.js deleted file mode 100644 index 39321f6206..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A10.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The Object.prototype.toString.length property has the attribute ReadOnly -es5id: 15.2.4.2_A10 -description: > - Checking if varying the Object.prototype.toString.length property - fails -includes: [propertyHelper.js] ----*/ - -//CHECK#1 -if (!(Object.prototype.toString.hasOwnProperty('length'))) { - $ERROR('#1: the Object.prototype.toString has length property.'); -} - -var obj = Object.prototype.toString.length; - -verifyNotWritable(Object.prototype.toString, "length", null, function() { - return "shifted"; -}); - -//CHECK#2 -if (Object.prototype.toString.length !== obj) { - $ERROR('#2: the Object.prototype.toString length property has the attributes ReadOnly.'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A11.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A11.js deleted file mode 100644 index a73e93a7d2..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A11.js +++ /dev/null @@ -1,18 +0,0 @@ -// 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 of the toString method is 0 -es5id: 15.2.4.2_A11 -description: Checking the Object.prototype.toString.length property ----*/ - -//CHECK#1 -if (!(Object.prototype.toString.hasOwnProperty("length"))) { - $ERROR('#1: The length property of the toString method is 0'); -} - -//CHECK#2 -if (Object.prototype.toString.length !== 0) { - $ERROR('#2: The length property of the toString method is 0'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A12.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A12.js deleted file mode 100644 index 2986526b2c..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A12.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2011 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2_A12 -description: If the this value is undefined, return "[object Undefined]". ----*/ - -if (Object.prototype.toString.call(undefined) !== "[object Undefined]") { - $ERROR('If the this value is undefined, return "[object Undefined]".'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A13.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A13.js deleted file mode 100644 index 9f414791fd..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A13.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2011 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2_A13 -description: If the this value is null, return "[object Null]". ----*/ - -if (Object.prototype.toString.call(null) !== "[object Null]") { - $ERROR('If the this value is null, return "[object Null]".'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A14.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A14.js deleted file mode 100644 index 496eec11b9..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A14.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2011 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2_A14 -description: > - Let O be the result of calling ToObject passing the this value as - the argument. ----*/ - -if (Object.prototype.toString.call(33) !== "[object Number]") { - $ERROR('Let O be the result of calling ToObject passing the this ' + - 'value as the argument.'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A15.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A15.js deleted file mode 100644 index 078962da36..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A15.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2011 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2_A15 -description: > - Let O be the result of calling ToObject passing the this value as - the argument. ----*/ - -if (Object.prototype.toString.call(true) !== "[object Boolean]") { - $ERROR('Let O be the result of calling ToObject passing the this ' + - 'value as the argument.'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A16.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A16.js deleted file mode 100644 index 616a35f091..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A16.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2011 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 15.2.4.2_A16 -description: > - Let O be the result of calling ToObject passing the this value as - the argument. ----*/ - -if (Object.prototype.toString.call('foo') !== "[object String]") { - $ERROR('Let O be the result of calling ToObject passing the this ' + - 'value as the argument.'); -} diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A6.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A6.js deleted file mode 100644 index 6c8e0d7ad1..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A6.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Object.prototype.toString has not prototype property -es5id: 15.2.4.2_A6 -description: > - Checking if obtaining the prototype property of - Object.prototype.toString fails ----*/ - -//CHECK#1 -if (Object.prototype.toString.prototype !== undefined) { - $ERROR('#1: Object.prototype.toString has not prototype property' + Object.prototype.toString.prototype); -} -// diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js deleted file mode 100644 index 99e331d7d9..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: Object.prototype.toString can't be used as a constructor -es5id: 15.2.4.2_A7 -description: Checking if creating "new Object.prototype.toString" fails ----*/ - -var FACTORY = Object.prototype.toString; - -assert.throws(TypeError, function() { - new FACTORY; -}); diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A8.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A8.js deleted file mode 100644 index 8a38eaa0eb..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A8.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: The Object.prototype.toString.length property has the attribute DontEnum -es5id: 15.2.4.2_A8 -description: > - Checking if enumerating the Object.prototype.toString.length - property fails ----*/ - -//CHECK#0 -if (!(Object.prototype.toString.hasOwnProperty('length'))) { - $ERROR('#0: the Object.prototype.toString has length property.'); -} - - -// CHECK#1 -if (Object.prototype.toString.propertyIsEnumerable('length')) { - $ERROR('#1: the Object.prototype.toString.length property has the attributes DontEnum'); -} - -// CHECK#2 -for (var p in Object.prototype.toString) { - if (p === "length") - $ERROR('#2: the Object.prototype.toString.length property has the attributes DontEnum'); -} -// diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A9.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A9.js deleted file mode 100644 index 798ebcc6c5..0000000000 --- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A9.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -info: | - The Object.prototype.toString.length property does not have the attribute - DontDelete -es5id: 15.2.4.2_A9 -description: > - Checknig if deleting of the Object.prototype.toString.length - property fails ----*/ - -//CHECK#0 -if (!(Object.prototype.toString.hasOwnProperty('length'))) { - $ERROR('#0: the Object.prototype.toString has length property'); -} - -//CHECK#1 -if (!delete Object.prototype.toString.length) { - $ERROR('#1: The Object.prototype.toString.length property does not have the attributes DontDelete'); -} - -//CHECK#2 -if (Object.prototype.toString.hasOwnProperty('length')) { - $ERROR('#2: The Object.prototype.toString.length property does not have the attributes DontDelete'); -} diff --git a/test/built-ins/Object/prototype/toString/direct-invocation.js b/test/built-ins/Object/prototype/toString/direct-invocation.js new file mode 100644 index 0000000000..9b5f183a7f --- /dev/null +++ b/test/built-ins/Object/prototype/toString/direct-invocation.js @@ -0,0 +1,17 @@ +// Copyright 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: Else, let builtinTag be "Object". +---*/ +assert.sameValue( + Object.prototype.toString(), + "[object Object]", + "Object.prototype.toString() returns [object Object]" +); +assert.sameValue( + {}.toString(), + "[object Object]", + "({}).toString() returns [object Object]" +); diff --git a/test/built-ins/Object/prototype/toString/length.js b/test/built-ins/Object/prototype/toString/length.js new file mode 100644 index 0000000000..96225ec962 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/length.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.tostring +description: > + Object.prototype.toString.length is 0. +info: | + Object.prototype.toString ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +verifyProperty(Object.prototype.toString, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true +}); diff --git a/test/built-ins/Object/prototype/toString/name.js b/test/built-ins/Object/prototype/toString/name.js index ed6f7c505f..25c0ffe7e3 100644 --- a/test/built-ins/Object/prototype/toString/name.js +++ b/test/built-ins/Object/prototype/toString/name.js @@ -19,8 +19,9 @@ info: | includes: [propertyHelper.js] ---*/ -assert.sameValue(Object.prototype.toString.name, "toString"); - -verifyNotEnumerable(Object.prototype.toString, "name"); -verifyNotWritable(Object.prototype.toString, "name"); -verifyConfigurable(Object.prototype.toString, "name"); +verifyProperty(Object.prototype.toString, "name", { + value: "toString", + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Object/prototype/toString/no-prototype-property.js b/test/built-ins/Object/prototype/toString/no-prototype-property.js new file mode 100644 index 0000000000..d82a7b95de --- /dev/null +++ b/test/built-ins/Object/prototype/toString/no-prototype-property.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: sec-object.prototype.tostring +description: Object.prototype.toString has no prototype property +---*/ + +assert.sameValue( + Object.prototype.toString.hasOwnProperty("prototype"), + false, + "Object.prototype.toString.hasOwnProperty(\"prototype\") returns false" +); diff --git a/test/built-ins/Object/prototype/toString/not-ctor.js b/test/built-ins/Object/prototype/toString/not-ctor.js new file mode 100644 index 0000000000..149ada629e --- /dev/null +++ b/test/built-ins/Object/prototype/toString/not-ctor.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: Object.prototype.toString is not a constructor +info: | + Built-in function objects that are not identified as constructors do + not implement the [[Construct]] internal method unless otherwise specified + in the description of a particular function +---*/ + +assert.throws(TypeError, function() { + new Object.prototype.toString(); +}); diff --git a/test/built-ins/Object/prototype/toString/prop-desc.js b/test/built-ins/Object/prototype/toString/prop-desc.js new file mode 100644 index 0000000000..7a2c7581a7 --- /dev/null +++ b/test/built-ins/Object/prototype/toString/prop-desc.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. + +/*--- +esid: sec-object.prototype.tostring +description: > + Object.prototype.toString property descriptor +info: | + 17 ECMAScript Standard Built-in Objects: + + ... + Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. + +includes: [propertyHelper.js] +---*/ + +verifyWritable(Object.prototype, "toString"); +verifyNotEnumerable(Object.prototype, "toString"); +verifyConfigurable(Object.prototype, "toString");