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

Side by Side Diff: test/mjsunit/object-get-own-property-names.js

Issue 596124: Object.getOwnPropertyNames should return string names for indexed properties (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 assertEquals(2, propertyNames.length); 50 assertEquals(2, propertyNames.length);
51 assertEquals("a", propertyNames[0]); 51 assertEquals("a", propertyNames[0]);
52 assertEquals("c", propertyNames[1]); 52 assertEquals("c", propertyNames[1]);
53 53
54 // Check that non-enumerable properties are being returned. 54 // Check that non-enumerable properties are being returned.
55 var propertyNames = Object.getOwnPropertyNames([1, 2]); 55 var propertyNames = Object.getOwnPropertyNames([1, 2]);
56 propertyNames.sort(); 56 propertyNames.sort();
57 assertEquals(3, propertyNames.length); 57 assertEquals(3, propertyNames.length);
58 assertEquals("0", propertyNames[0]); 58 assertEquals("0", propertyNames[0]);
59 assertEquals("1", propertyNames[1]); 59 assertEquals("1", propertyNames[1]);
60 assertEquals("string", typeof propertyNames[0]);
61 assertEquals("string", typeof propertyNames[1]);
60 assertEquals("length", propertyNames[2]); 62 assertEquals("length", propertyNames[2]);
61 63
62 // Check that no proto properties are returned. 64 // Check that no proto properties are returned.
63 var obj = { foo: "foo" }; 65 var obj = { foo: "foo" };
64 obj.__proto__ = { bar: "bar" }; 66 obj.__proto__ = { bar: "bar" };
65 propertyNames = Object.getOwnPropertyNames(obj); 67 propertyNames = Object.getOwnPropertyNames(obj);
66 propertyNames.sort(); 68 propertyNames.sort();
67 assertEquals(1, propertyNames.length); 69 assertEquals(1, propertyNames.length);
68 assertEquals("foo", propertyNames[0]); 70 assertEquals("foo", propertyNames[0]);
69 71
(...skipping 25 matching lines...) Expand all
95 } catch (e) { 97 } catch (e) {
96 assertTrue(/on non-object/.test(e)); 98 assertTrue(/on non-object/.test(e));
97 } 99 }
98 100
99 try { 101 try {
100 Object.getOwnPropertyNames(null); 102 Object.getOwnPropertyNames(null);
101 assertTrue(false); 103 assertTrue(false);
102 } catch (e) { 104 } catch (e) {
103 assertTrue(/on non-object/.test(e)); 105 assertTrue(/on non-object/.test(e));
104 } 106 }
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