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

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

Issue 613283002: Convert argument toObject() in Object.getOwnPropertyNames/Descriptors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: FAIL_OK rather than SKIP 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 | « test/mjsunit/es6/symbols.js ('k') | test/test262/test262.status » ('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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Check that implementation does not access Array.prototype. 80 // Check that implementation does not access Array.prototype.
81 var savedConcat = Array.prototype.concat; 81 var savedConcat = Array.prototype.concat;
82 Array.prototype.concat = function() { return []; } 82 Array.prototype.concat = function() { return []; }
83 propertyNames = Object.getOwnPropertyNames({0: 'foo', bar: 'baz'}); 83 propertyNames = Object.getOwnPropertyNames({0: 'foo', bar: 'baz'});
84 assertEquals(2, propertyNames.length); 84 assertEquals(2, propertyNames.length);
85 assertEquals('0', propertyNames[0]); 85 assertEquals('0', propertyNames[0]);
86 assertEquals('bar', propertyNames[1]); 86 assertEquals('bar', propertyNames[1]);
87 assertSame(Array.prototype, propertyNames.__proto__); 87 assertSame(Array.prototype, propertyNames.__proto__);
88 Array.prototype.concat = savedConcat; 88 Array.prototype.concat = savedConcat;
89 89
90 try { 90 assertEquals(Object.getOwnPropertyNames(4), []);
91 Object.getOwnPropertyNames(4); 91 assertEquals(Object.getOwnPropertyNames("foo"), ["0", "1", "2", "length"]);
92 assertTrue(false); 92 assertEquals(Object.getOwnPropertyNames(true), []);
93 } catch (e) {
94 assertTrue(/on non-object/.test(e));
95 }
96
97 try {
98 Object.getOwnPropertyNames("foo");
99 assertTrue(false);
100 } catch (e) {
101 assertTrue(/on non-object/.test(e));
102 }
103 93
104 try { 94 try {
105 Object.getOwnPropertyNames(undefined); 95 Object.getOwnPropertyNames(undefined);
106 assertTrue(false); 96 assertTrue(false);
107 } catch (e) { 97 } catch (e) {
108 assertTrue(/on non-object/.test(e)); 98 assertTrue(/Cannot convert undefined or null to object/.test(e));
109 } 99 }
110 100
111 try { 101 try {
112 Object.getOwnPropertyNames(null); 102 Object.getOwnPropertyNames(null);
113 assertTrue(false); 103 assertTrue(false);
114 } catch (e) { 104 } catch (e) {
115 assertTrue(/on non-object/.test(e)); 105 assertTrue(/Cannot convert undefined or null to object/.test(e));
116 } 106 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/symbols.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698