Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: test/mjsunit/es6/symbols.js

Issue 389263003: Make ToPrimitive throw on symbol wrappers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/symbols.js
diff --git a/test/mjsunit/es6/symbols.js b/test/mjsunit/es6/symbols.js
index b465bee14a9b4630af3eb56be4bf18ccf008fc9c..7c211ca3f71e443448cd12fb37faa8eb5c9742e0 100644
--- a/test/mjsunit/es6/symbols.js
+++ b/test/mjsunit/es6/symbols.js
@@ -102,7 +102,9 @@ TestConstructor()
function TestValueOf() {
for (var i in symbols) {
+ assertTrue(symbols[i] === Object(symbols[i]).valueOf())
assertTrue(symbols[i] === symbols[i].valueOf())
+ assertTrue(Symbol.prototype.valueOf.call(Object(symbols[i])) === symbols[i])
assertTrue(Symbol.prototype.valueOf.call(symbols[i]) === symbols[i])
}
}
@@ -113,7 +115,7 @@ function TestToString() {
for (var i in symbols) {
assertThrows(function() { String(symbols[i]) }, TypeError)
assertThrows(function() { symbols[i] + "" }, TypeError)
- assertTrue(isValidSymbolString(String(Object(symbols[i]))))
+ assertThrows(function() { String(Object(symbols[i])) }, TypeError)
assertTrue(isValidSymbolString(symbols[i].toString()))
assertTrue(isValidSymbolString(Object(symbols[i]).toString()))
assertTrue(
@@ -127,6 +129,8 @@ TestToString()
function TestToBoolean() {
for (var i in symbols) {
+ assertTrue(Boolean(Object(symbols[i])))
+ assertFalse(!Object(symbols[i]))
assertTrue(Boolean(symbols[i]).valueOf())
assertFalse(!symbols[i])
assertTrue(!!symbols[i])
@@ -144,6 +148,8 @@ TestToBoolean()
function TestToNumber() {
for (var i in symbols) {
+ assertThrows(function() { Number(Object(symbols[i])) }, TypeError)
+ assertThrows(function() { +Object(symbols[i]) }, TypeError)
assertSame(NaN, Number(symbols[i]).valueOf())
assertSame(NaN, symbols[i] + 0)
}
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698