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

Side by Side Diff: test/mjsunit/harmony/private.js

Issue 564863002: ES6: String(symbol) should work like symbol.toString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review feedback Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/es6/symbols.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 for (var i in symbols) { 76 for (var i in symbols) {
77 assertSame(Symbol, symbols[i].__proto__.constructor) 77 assertSame(Symbol, symbols[i].__proto__.constructor)
78 assertSame(Symbol, Object(symbols[i]).__proto__.constructor) 78 assertSame(Symbol, Object(symbols[i]).__proto__.constructor)
79 } 79 }
80 } 80 }
81 TestConstructor() 81 TestConstructor()
82 82
83 83
84 function TestToString() { 84 function TestToString() {
85 for (var i in symbols) { 85 for (var i in symbols) {
86 assertThrows(function() { String(symbols[i]) }, TypeError) 86 assertThrows(function() {new String(symbols[i]) }, TypeError)
87 assertEquals(symbols[i].toString(), String(symbols[i]))
87 assertThrows(function() { symbols[i] + "" }, TypeError) 88 assertThrows(function() { symbols[i] + "" }, TypeError)
88 assertTrue(isValidSymbolString(symbols[i].toString())) 89 assertTrue(isValidSymbolString(symbols[i].toString()))
89 assertTrue(isValidSymbolString(Object(symbols[i]).toString())) 90 assertTrue(isValidSymbolString(Object(symbols[i]).toString()))
90 assertTrue(isValidSymbolString(Symbol.prototype.toString.call(symbols[i]))) 91 assertTrue(isValidSymbolString(Symbol.prototype.toString.call(symbols[i])))
91 assertEquals( 92 assertEquals(
92 "[object Symbol]", Object.prototype.toString.call(symbols[i])) 93 "[object Symbol]", Object.prototype.toString.call(symbols[i]))
93 } 94 }
94 } 95 }
95 TestToString() 96 TestToString()
96 97
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 obj[sym] = 1 350 obj[sym] = 1
350 freeze(obj) 351 freeze(obj)
351 obj[sym] = 2 352 obj[sym] = 2
352 assertEquals(2, obj[sym]) 353 assertEquals(2, obj[sym])
353 assertTrue(delete obj[sym]) 354 assertTrue(delete obj[sym])
354 assertEquals(undefined, obj[sym]) 355 assertEquals(undefined, obj[sym])
355 } 356 }
356 TestSealAndFreeze(Object.seal) 357 TestSealAndFreeze(Object.seal)
357 TestSealAndFreeze(Object.freeze) 358 TestSealAndFreeze(Object.freeze)
358 TestSealAndFreeze(Object.preventExtensions) 359 TestSealAndFreeze(Object.preventExtensions)
OLDNEW
« no previous file with comments | « test/mjsunit/es6/symbols.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698