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

Side by Side Diff: test/mjsunit/third_party/object-keys.js

Issue 608193002: Revert "Convert `obj` ToObject in Object.keys()" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « src/v8natives.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 (c) 2006 Apple Computer, Inc. All rights reserved. 1 // Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions 4 // modification, are permitted provided that the following conditions
5 // are met: 5 // are met:
6 // 6 //
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 9 //
10 // 2. Redistributions in binary form must reproduce the above 10 // 2. Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30 // OF THE POSSIBILITY OF SUCH DAMAGE. 30 // OF THE POSSIBILITY OF SUCH DAMAGE.
31 31
32 // Based on LayoutTests/fast/js/Object-keys.html 32 // Based on LayoutTests/fast/js/Object-keys.html
33 33
34 assertEquals(Object.keys(2), []); 34 assertThrows(function () { Object.keys(2) }, TypeError);
35 assertEquals(Object.keys("foo"), ["0", "1", "2"]); 35 assertThrows(function () { Object.keys("foo") }, TypeError);
36 assertThrows(function () { Object.keys(null) }, TypeError); 36 assertThrows(function () { Object.keys(null) }, TypeError);
37 assertThrows(function () { Object.keys(undefined) }, TypeError); 37 assertThrows(function () { Object.keys(undefined) }, TypeError);
38 38
39 assertEquals(Object.keys({}), []); 39 assertEquals(Object.keys({}), []);
40 assertEquals(Object.keys({a:null}), ['a']); 40 assertEquals(Object.keys({a:null}), ['a']);
41 assertEquals(Object.keys({a:null, b:null}), ['a', 'b']); 41 assertEquals(Object.keys({a:null, b:null}), ['a', 'b']);
42 assertEquals(Object.keys({b:null, a:null}), ['b', 'a']); 42 assertEquals(Object.keys({b:null, a:null}), ['b', 'a']);
43 assertEquals(Object.keys([]), []); 43 assertEquals(Object.keys([]), []);
44 assertEquals(Object.keys([null]), ['0']); 44 assertEquals(Object.keys([null]), ['0']);
45 assertEquals(Object.keys([null,null]), ['0', '1']); 45 assertEquals(Object.keys([null,null]), ['0', '1']);
(...skipping 13 matching lines...) Expand all
59 59
60 argsTest(1, 2, 3); 60 argsTest(1, 2, 3);
61 61
62 var literal = {a: 1, b: 2, c: 3}; 62 var literal = {a: 1, b: 2, c: 3};
63 var keysBefore = Object.keys(literal); 63 var keysBefore = Object.keys(literal);
64 assertEquals(['a', 'b', 'c'], keysBefore); 64 assertEquals(['a', 'b', 'c'], keysBefore);
65 keysBefore[0] = 'x'; 65 keysBefore[0] = 'x';
66 var keysAfter = Object.keys(literal); 66 var keysAfter = Object.keys(literal);
67 assertEquals(['a', 'b', 'c'], keysAfter); 67 assertEquals(['a', 'b', 'c'], keysAfter);
68 assertEquals(['x', 'b', 'c'], keysBefore); 68 assertEquals(['x', 'b', 'c'], keysBefore);
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698