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

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

Issue 9429008: Fixed Object.getOwnPropertyDescriptor(string, index) to return descriptor's enumerable property as … (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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/runtime.cc ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 var descObjectElement = Object.getOwnPropertyDescriptor(obj, '1'); 66 var descObjectElement = Object.getOwnPropertyDescriptor(obj, '1');
67 assertTrue(descObjectElement.enumerable); 67 assertTrue(descObjectElement.enumerable);
68 assertTrue(descObjectElement.configurable); 68 assertTrue(descObjectElement.configurable);
69 assertTrue(descObjectElement.writable); 69 assertTrue(descObjectElement.writable);
70 assertEquals(descObjectElement.value, 42); 70 assertEquals(descObjectElement.value, 42);
71 71
72 // String objects. 72 // String objects.
73 var a = new String('foobar'); 73 var a = new String('foobar');
74 for (var i = 0; i < a.length; i++) { 74 for (var i = 0; i < a.length; i++) {
75 var descStringObject = Object.getOwnPropertyDescriptor(a, i); 75 var descStringObject = Object.getOwnPropertyDescriptor(a, i);
76 assertFalse(descStringObject.enumerable); 76 // according to http://es5.github.com/#x15.5.5.2 step 9 enumerable needs to be true
77 assertTrue(descStringObject.enumerable);
77 assertFalse(descStringObject.configurable); 78 assertFalse(descStringObject.configurable);
78 assertFalse(descStringObject.writable); 79 assertFalse(descStringObject.writable);
79 assertEquals(descStringObject.value, a.substring(i, i+1)); 80 assertEquals(descStringObject.value, a.substring(i, i+1));
80 } 81 }
81 82
82 // Support for additional attributes on string objects. 83 // Support for additional attributes on string objects.
83 a.x = 42; 84 a.x = 42;
84 a[10] = 'foo'; 85 a[10] = 'foo';
85 var descStringProperty = Object.getOwnPropertyDescriptor(a, 'x'); 86 var descStringProperty = Object.getOwnPropertyDescriptor(a, 'x');
86 assertTrue(descStringProperty.enumerable); 87 assertTrue(descStringProperty.enumerable);
(...skipping 25 matching lines...) Expand all
112 function el_getter() { return 239; }; 113 function el_getter() { return 239; };
113 function el_setter() {}; 114 function el_setter() {};
114 Object.defineProperty(global, '239', {get: el_getter, set: el_setter}); 115 Object.defineProperty(global, '239', {get: el_getter, set: el_setter});
115 116
116 var descRegularElement = Object.getOwnPropertyDescriptor(global, '42'); 117 var descRegularElement = Object.getOwnPropertyDescriptor(global, '42');
117 assertEquals(42, descRegularElement.value); 118 assertEquals(42, descRegularElement.value);
118 119
119 var descAccessorElement = Object.getOwnPropertyDescriptor(global, '239'); 120 var descAccessorElement = Object.getOwnPropertyDescriptor(global, '239');
120 assertEquals(el_getter, descAccessorElement.get); 121 assertEquals(el_getter, descAccessorElement.get);
121 assertEquals(el_setter, descAccessorElement.set); 122 assertEquals(el_setter, descAccessorElement.set);
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698