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

Side by Side Diff: test/mjsunit/harmony/set-prototype-of.js

Issue 1033623002: Revert of [es6] Object.getPrototypeOf should work with values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « test/mjsunit/get-prototype-of.js ('k') | test/test262-es6/test262-es6.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 null 57 null
58 ]; 58 ];
59 59
60 60
61 var valuesWithoutNull = coercibleValues.concat(undefined); 61 var valuesWithoutNull = coercibleValues.concat(undefined);
62 62
63 63
64 function TestSetPrototypeOfCoercibleValues() { 64 function TestSetPrototypeOfCoercibleValues() {
65 for (var i = 0; i < coercibleValues.length; i++) { 65 for (var i = 0; i < coercibleValues.length; i++) {
66 var value = coercibleValues[i]; 66 var value = coercibleValues[i];
67 var proto = Object.getPrototypeOf(value); 67 assertThrows(function() {
68 Object.getPrototypeOf(value);
69 }, TypeError);
70
68 assertEquals(Object.setPrototypeOf(value, {}), value); 71 assertEquals(Object.setPrototypeOf(value, {}), value);
69 assertSame(proto, Object.getPrototypeOf(value)); 72
73 assertThrows(function() {
74 Object.getPrototypeOf(value);
75 }, TypeError);
70 } 76 }
71 } 77 }
72 TestSetPrototypeOfCoercibleValues(); 78 TestSetPrototypeOfCoercibleValues();
73 79
74 80
75 function TestSetPrototypeOfNonCoercibleValues() { 81 function TestSetPrototypeOfNonCoercibleValues() {
76 for (var i = 0; i < nonCoercibleValues.length; i++) { 82 for (var i = 0; i < nonCoercibleValues.length; i++) {
77 var value = nonCoercibleValues[i]; 83 var value = nonCoercibleValues[i];
78 assertThrows(function() { 84 assertThrows(function() {
79 Object.setPrototypeOf(value, {}); 85 Object.setPrototypeOf(value, {});
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 assertEquals(object.y, 'old y'); 159 assertEquals(object.y, 'old y');
154 160
155 var newProto = { 161 var newProto = {
156 x: 'new x' 162 x: 'new x'
157 }; 163 };
158 Object.setPrototypeOf(object, newProto); 164 Object.setPrototypeOf(object, newProto);
159 assertEquals(object.x, 'new x'); 165 assertEquals(object.x, 'new x');
160 assertFalse('y' in object); 166 assertFalse('y' in object);
161 } 167 }
162 TestLookup(); 168 TestLookup();
OLDNEW
« no previous file with comments | « test/mjsunit/get-prototype-of.js ('k') | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698