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

Unified Diff: test/mjsunit/es6/object-assign.js

Issue 1688953004: [builtins] Add an initial fast-path to Object.assign. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« src/objects.cc ('K') | « src/property-details.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/object-assign.js
diff --git a/test/mjsunit/es6/object-assign.js b/test/mjsunit/es6/object-assign.js
index d56cb0d1cf3a0acc4debcd093dc8abe0552238a9..1fec766dd1599c989ce2077dcc9546e81748418b 100644
--- a/test/mjsunit/es6/object-assign.js
+++ b/test/mjsunit/es6/object-assign.js
@@ -138,3 +138,36 @@ assertSame(Object.assign(o, {}), o);
assertThrows(function() { return Object.assign(target, source); }, ErrorB);
assertEquals(log, "b");
})();
+
+(function add_to_source() {
+ var target = {set k1(v) { source.k3 = 100; }};
+ var source = {k1:10};
+ Object.defineProperty(source, "k2",
+ {value: 20, enumerable: false, configurable: true});
+ Object.assign(target, source);
+ assertEquals(undefined, target.k2);
+ assertEquals(undefined, target.k3);
+})();
+
+(function reconfigure_enumerable_source() {
+ var target = {set k1(v) {
+ Object.defineProperty(source, "k2", {value: 20, enumerable: true});
+ }};
+ var source = {k1:10};
+ Object.defineProperty(source, "k2",
+ {value: 20, enumerable: false, configurable: true});
+ Object.assign(target, source);
+ assertEquals(20, target.k2);
+})();
+
+(function propagate_assign_failure() {
+ var target = {set k1(v) { throw "fail" }};
+ var source = {k1:10};
+ assertThrows(()=>Object.assign(target, source));
+})();
+
+(function propagate_read_failure() {
+ var target = {};
+ var source = {get k1() { throw "fail" }};
+ assertThrows(()=>Object.assign(target, source));
+})();
« src/objects.cc ('K') | « src/property-details.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698