diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-03-27 12:04:12 +0100 |
---|---|---|
committer | Chris Dickinson <christopher.s.dickinson@gmail.com> | 2015-04-28 14:38:16 -0700 |
commit | 36cd5fb9d27b830320e57213f5b8829ffbb93324 (patch) | |
tree | bbab4215d26f8597019135206426fccf27a3089e /deps/v8/test/mjsunit/es6 | |
parent | b57cc51d8d3f4ad279591ae8fa6584ee22773b97 (diff) | |
download | android-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.tar.gz android-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.tar.bz2 android-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.zip |
deps: upgrade v8 to 4.2.77.13
This commit applies some secondary changes in order to make `make test`
pass cleanly:
* disable broken postmortem debugging in common.gypi
* drop obsolete strict mode test in parallel/test-repl
* drop obsolete test parallel/test-v8-features
PR-URL: https://github.com/iojs/io.js/pull/1232
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'deps/v8/test/mjsunit/es6')
-rw-r--r-- | deps/v8/test/mjsunit/es6/array-tostring.js | 157 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/es6/iteration-syntax.js | 48 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/es6/object-tostring.js | 14 |
3 files changed, 196 insertions, 23 deletions
diff --git a/deps/v8/test/mjsunit/es6/array-tostring.js b/deps/v8/test/mjsunit/es6/array-tostring.js new file mode 100644 index 0000000000..8a9198ca16 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/array-tostring.js @@ -0,0 +1,157 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-tostring + +var global = this; + +var funs = { + Object: [ Object ], + Function: [ Function ], + String: [ String ], + Boolean: [ Boolean ], + Number: [ Number ], + Date: [ Date ], + RegExp: [ RegExp ], + Error: [ Error, TypeError, RangeError, SyntaxError, ReferenceError, + EvalError, URIError ] +} +for (f in funs) { + for (i in funs[f]) { + assertEquals("[object " + f + "]", + Array.prototype.toString.call(new funs[f][i]), + funs[f][i]); + assertEquals("[object Function]", + Array.prototype.toString.call(funs[f][i]), + funs[f][i]); + } +} + + +function testToStringTag(className) { + // Using builtin toStringTags + var obj = {}; + obj[Symbol.toStringTag] = className; + assertEquals("[object " + className + "]", + Array.prototype.toString.call(obj)); + + // Getter throws + obj = {}; + Object.defineProperty(obj, Symbol.toStringTag, { + get: function() { throw className; } + }); + assertThrows(function() { + Array.prototype.toString.call(obj); + }, className); + + // Getter does not throw + obj = {}; + Object.defineProperty(obj, Symbol.toStringTag, { + get: function() { return className; } + }); + assertEquals("[object " + className + "]", + Array.prototype.toString.call(obj)); + + // Custom, non-builtin toStringTags + obj = {}; + obj[Symbol.toStringTag] = "X" + className; + assertEquals("[object X" + className + "]", + Array.prototype.toString.call(obj)); + + // With getter + obj = {}; + Object.defineProperty(obj, Symbol.toStringTag, { + get: function() { return "X" + className; } + }); + assertEquals("[object X" + className + "]", + Array.prototype.toString.call(obj)); + + // Undefined toStringTag should return [object className] + var obj = className === "Arguments" ? + (function() { return arguments; })() : new global[className]; + obj[Symbol.toStringTag] = undefined; + assertEquals("[object " + className + "]", + Array.prototype.toString.call(obj)); + + // With getter + var obj = className === "Arguments" ? + (function() { return arguments; })() : new global[className]; + Object.defineProperty(obj, Symbol.toStringTag, { + get: function() { return undefined; } + }); + assertEquals("[object " + className + "]", + Array.prototype.toString.call(obj)); +} + + +[ + "Arguments", + "Boolean", + "Date", + "Error", + "Function", + "Number", + "RegExp", + "String" +].forEach(testToStringTag); + + +function testToStringTagNonString(value) { + var obj = {}; + obj[Symbol.toStringTag] = value; + assertEquals("[object Object]", Array.prototype.toString.call(obj)); + + // With getter + obj = {}; + Object.defineProperty(obj, Symbol.toStringTag, { + get: function() { return value; } + }); + assertEquals("[object Object]", Array.prototype.toString.call(obj)); +} + + +[ + null, + function() {}, + [], + {}, + /regexp/, + 42, + Symbol("sym"), + new Date(), + (function() { return arguments; })(), + true, + new Error("oops"), + new String("str") +].forEach(testToStringTagNonString); + + +function testArrayToStringPropertyDesc() { + var desc = Object.getOwnPropertyDescriptor(Object.prototype, "toString"); + assertTrue(desc.writable); + assertFalse(desc.enumerable); + assertTrue(desc.configurable); +} +testArrayToStringPropertyDesc(); + + +function testArrayToStringOwnNonStringValue() { + var obj = Object.defineProperty({}, Symbol.toStringTag, { value: 1 }); + assertEquals("[object Object]", ([]).toString.call(obj)); +} +testArrayToStringOwnNonStringValue(); + + +function testArrayToStringBasic() { + assertEquals("1,2,3", [1,2,3].toString()); + assertEquals(",,3", [,,3].toString()); +} +testArrayToStringBasic(); + + +function testArrayToStringObjectWithCallableJoin() { + var obj = { join: function() { return "CallableJoin"; } }; + assertEquals("CallableJoin", Array.prototype.toString.call(obj)); +} +testArrayToStringObjectWithCallableJoin(); diff --git a/deps/v8/test/mjsunit/es6/iteration-syntax.js b/deps/v8/test/mjsunit/es6/iteration-syntax.js index 356a97898a..4be94c5db4 100644 --- a/deps/v8/test/mjsunit/es6/iteration-syntax.js +++ b/deps/v8/test/mjsunit/es6/iteration-syntax.js @@ -25,7 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --harmony-scoping --use-strict +// Flags: --harmony-scoping // Test for-of syntax. @@ -35,28 +35,38 @@ function f() { for (x of y) { } } function f() { for (var x of y) { } } function f() { for (let x of y) { } } -assertThrows("function f() { for (x of) { } }", SyntaxError); -assertThrows("function f() { for (x of y z) { } }", SyntaxError); -assertThrows("function f() { for (x of y;) { } }", SyntaxError); +function StrictSyntaxError(s) { + try { + eval(s); + } catch (e) { + assertInstanceof(e, SyntaxError); + return; + } + throw "did not throw"; +} -assertThrows("function f() { for (var x of) { } }", SyntaxError); -assertThrows("function f() { for (var x of y z) { } }", SyntaxError); -assertThrows("function f() { for (var x of y;) { } }", SyntaxError); +StrictSyntaxError("function f() { for (x of) { } }"); +StrictSyntaxError("function f() { for (x of y z) { } }"); +StrictSyntaxError("function f() { for (x of y;) { } }"); -assertThrows("function f() { for (let x of) { } }", SyntaxError); -assertThrows("function f() { for (let x of y z) { } }", SyntaxError); -assertThrows("function f() { for (let x of y;) { } }", SyntaxError); +StrictSyntaxError("function f() { for (var x of) { } }"); +StrictSyntaxError("function f() { for (var x of y z) { } }"); +StrictSyntaxError("function f() { for (var x of y;) { } }"); -assertThrows("function f() { for (of y) { } }", SyntaxError); -assertThrows("function f() { for (of of) { } }", SyntaxError); -assertThrows("function f() { for (var of y) { } }", SyntaxError); -assertThrows("function f() { for (var of of) { } }", SyntaxError); -assertThrows("function f() { for (let of y) { } }", SyntaxError); -assertThrows("function f() { for (let of of) { } }", SyntaxError); +StrictSyntaxError("function f() { for (let x of) { } }"); +StrictSyntaxError("function f() { for (let x of y z) { } }"); +StrictSyntaxError("function f() { for (let x of y;) { } }"); -assertThrows("function f() { for (x = 3 of y) { } }", SyntaxError); -assertThrows("function f() { for (var x = 3 of y) { } }", SyntaxError); -assertThrows("function f() { for (let x = 3 of y) { } }", SyntaxError); +StrictSyntaxError("function f() { for (of y) { } }"); +StrictSyntaxError("function f() { for (of of) { } }"); +StrictSyntaxError("function f() { for (var of y) { } }"); +StrictSyntaxError("function f() { for (var of of) { } }"); +StrictSyntaxError("function f() { for (let of y) { } }"); +StrictSyntaxError("function f() { for (let of of) { } }"); + +StrictSyntaxError("function f() { for (x = 3 of y) { } }"); +StrictSyntaxError("function f() { for (var x = 3 of y) { } }"); +StrictSyntaxError("function f() { for (let x = 3 of y) { } }"); // Alack, this appears to be valid. diff --git a/deps/v8/test/mjsunit/es6/object-tostring.js b/deps/v8/test/mjsunit/es6/object-tostring.js index 26dff14b9d..c73a7686cd 100644 --- a/deps/v8/test/mjsunit/es6/object-tostring.js +++ b/deps/v8/test/mjsunit/es6/object-tostring.js @@ -33,7 +33,7 @@ function testToStringTag(className) { // Using builtin toStringTags var obj = {}; obj[Symbol.toStringTag] = className; - assertEquals("[object ~" + className + "]", + assertEquals("[object " + className + "]", Object.prototype.toString.call(obj)); // Getter throws @@ -50,7 +50,7 @@ function testToStringTag(className) { Object.defineProperty(obj, Symbol.toStringTag, { get: function() { return className; } }); - assertEquals("[object ~" + className + "]", + assertEquals("[object " + className + "]", Object.prototype.toString.call(obj)); // Custom, non-builtin toStringTags @@ -99,14 +99,14 @@ function testToStringTag(className) { function testToStringTagNonString(value) { var obj = {}; obj[Symbol.toStringTag] = value; - assertEquals("[object ???]", Object.prototype.toString.call(obj)); + assertEquals("[object Object]", Object.prototype.toString.call(obj)); // With getter obj = {}; Object.defineProperty(obj, Symbol.toStringTag, { get: function() { return value; } }); - assertEquals("[object ???]", Object.prototype.toString.call(obj)); + assertEquals("[object Object]", Object.prototype.toString.call(obj)); } [ @@ -131,3 +131,9 @@ function testObjectToStringPropertyDesc() { assertTrue(desc.configurable); } testObjectToStringPropertyDesc(); + +function testObjectToStringOwnNonStringValue() { + var obj = Object.defineProperty({}, Symbol.toStringTag, { value: 1 }); + assertEquals("[object Object]", ({}).toString.call(obj)); +} +testObjectToStringOwnNonStringValue(); |