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

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

Issue 458753004: ToNumber(Symbol) should throw TypeError (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use IS_SYMBOL instead Created 6 years, 4 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') | test/mjsunit/object-toprimitive.js » ('j') | 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 assertEquals(2, !symbols[i] ? 1 : 2) 107 assertEquals(2, !symbols[i] ? 1 : 2)
108 if (!symbols[i]) assertUnreachable(); 108 if (!symbols[i]) assertUnreachable();
109 if (symbols[i]) {} else assertUnreachable(); 109 if (symbols[i]) {} else assertUnreachable();
110 } 110 }
111 } 111 }
112 TestToBoolean() 112 TestToBoolean()
113 113
114 114
115 function TestToNumber() { 115 function TestToNumber() {
116 for (var i in symbols) { 116 for (var i in symbols) {
117 assertSame(NaN, Number(symbols[i]).valueOf()) 117 assertThrows(function() { Number(symbols[i]); }, TypeError);
118 assertSame(NaN, symbols[i] + 0) 118 assertThrows(function() { symbols[i] + 0; }, TypeError);
119 } 119 }
120 } 120 }
121 TestToNumber() 121 TestToNumber()
122 122
123 123
124 function TestEquality() { 124 function TestEquality() {
125 // Every symbol should equal itself, and non-strictly equal its wrapper. 125 // Every symbol should equal itself, and non-strictly equal its wrapper.
126 for (var i in symbols) { 126 for (var i in symbols) {
127 assertSame(symbols[i], symbols[i]) 127 assertSame(symbols[i], symbols[i])
128 assertEquals(symbols[i], symbols[i]) 128 assertEquals(symbols[i], symbols[i])
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 obj[sym] = 1 349 obj[sym] = 1
350 freeze(obj) 350 freeze(obj)
351 obj[sym] = 2 351 obj[sym] = 2
352 assertEquals(2, obj[sym]) 352 assertEquals(2, obj[sym])
353 assertTrue(delete obj[sym]) 353 assertTrue(delete obj[sym])
354 assertEquals(undefined, obj[sym]) 354 assertEquals(undefined, obj[sym])
355 } 355 }
356 TestSealAndFreeze(Object.seal) 356 TestSealAndFreeze(Object.seal)
357 TestSealAndFreeze(Object.freeze) 357 TestSealAndFreeze(Object.freeze)
358 TestSealAndFreeze(Object.preventExtensions) 358 TestSealAndFreeze(Object.preventExtensions)
OLDNEW
« no previous file with comments | « test/mjsunit/es6/symbols.js ('k') | test/mjsunit/object-toprimitive.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698