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

Side by Side Diff: test/mjsunit/es6/generators-runtime.js

Issue 1051363003: Correct property descriptors on GeneratorPrototype (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « src/generator.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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 var expected_property_names = ["next", "throw", "constructor"]; 93 var expected_property_names = ["next", "throw", "constructor"];
94 var found_property_names = 94 var found_property_names =
95 Object.getOwnPropertyNames(GeneratorObjectPrototype); 95 Object.getOwnPropertyNames(GeneratorObjectPrototype);
96 96
97 expected_property_names.sort(); 97 expected_property_names.sort();
98 found_property_names.sort(); 98 found_property_names.sort();
99 99
100 assertArrayEquals(expected_property_names, found_property_names); 100 assertArrayEquals(expected_property_names, found_property_names);
101 101
102 iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype, 102 var constructor_desc = Object.getOwnPropertyDescriptor(
103 GeneratorObjectPrototype, "constructor");
104 assertTrue(constructor_desc !== undefined);
105 assertFalse(constructor_desc.writable);
106 assertFalse(constructor_desc.enumerable);
107 assertTrue(constructor_desc.configurable);
108
109 var next_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
110 "next");
111 assertTrue(next_desc !== undefined);
112 assertTrue(next_desc.writable);
113 assertFalse(next_desc.enumerable);
114 assertTrue(next_desc.configurable);
115
116 var throw_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
117 "throw");
118 assertTrue(next_desc !== undefined);
119 assertTrue(next_desc.writable);
120 assertFalse(next_desc.enumerable);
121 assertTrue(next_desc.configurable);
122
123 var iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
103 Symbol.iterator); 124 Symbol.iterator);
104 assertTrue(iterator_desc !== undefined); 125 assertTrue(iterator_desc !== undefined);
105 assertFalse(iterator_desc.writable); 126 assertFalse(iterator_desc.writable);
106 assertFalse(iterator_desc.enumerable); 127 assertFalse(iterator_desc.enumerable);
107 assertFalse(iterator_desc.configurable); 128 assertFalse(iterator_desc.configurable);
108 129
109 // The generator object's "iterator" function is just the identity. 130 // The generator object's "iterator" function is just the identity.
110 assertSame(iterator_desc.value.call(42), 42); 131 assertSame(iterator_desc.value.call(42), 42);
111 } 132 }
112 TestGeneratorObjectPrototype(); 133 TestGeneratorObjectPrototype();
(...skipping 24 matching lines...) Expand all
137 assertTrue((function*(){}).prototype !== (function*(){}).prototype); 158 assertTrue((function*(){}).prototype !== (function*(){}).prototype);
138 assertTrue((function*(){}).prototype !== g.prototype); 159 assertTrue((function*(){}).prototype !== g.prototype);
139 assertTrue(g.prototype instanceof GeneratorFunctionPrototype); 160 assertTrue(g.prototype instanceof GeneratorFunctionPrototype);
140 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype)); 161 assertSame(GeneratorObjectPrototype, Object.getPrototypeOf(g.prototype));
141 assertTrue(!(g.prototype instanceof Function)); 162 assertTrue(!(g.prototype instanceof Function));
142 assertSame(typeof (g.prototype), "object"); 163 assertSame(typeof (g.prototype), "object");
143 164
144 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype)); 165 assertArrayEquals([], Object.getOwnPropertyNames(g.prototype));
145 } 166 }
146 TestPerGeneratorPrototype(); 167 TestPerGeneratorPrototype();
OLDNEW
« no previous file with comments | « src/generator.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698