| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-proxies | |
| 6 | |
| 7 var handler = { | 5 var handler = { |
| 8 ownKeys: function(t) { return ["a", "b"]; }, | 6 ownKeys: function(t) { return ["a", "b"]; }, |
| 9 getOwnPropertyDescriptor: function(t, p) { | 7 getOwnPropertyDescriptor: function(t, p) { |
| 10 return {enumerable: true, configurable: true} | 8 return {enumerable: true, configurable: true} |
| 11 }, | 9 }, |
| 12 get: function(t, p) { | 10 get: function(t, p) { |
| 13 return 1; | 11 return 1; |
| 14 } | 12 } |
| 15 }; | 13 }; |
| 16 | 14 |
| 17 var proxy = new Proxy({}, handler); | 15 var proxy = new Proxy({}, handler); |
| 18 | 16 |
| 19 var o = {}; | 17 var o = {}; |
| 20 | 18 |
| 21 Object.assign(o, proxy); | 19 Object.assign(o, proxy); |
| 22 | 20 |
| 23 assertEquals({"a": 1, "b": 1}, o); | 21 assertEquals({"a": 1, "b": 1}, o); |
| 24 | 22 |
| 25 (function TestStringSources() { | 23 (function TestStringSources() { |
| 26 var source = "abc"; | 24 var source = "abc"; |
| 27 var target = {}; | 25 var target = {}; |
| 28 Object.assign(target, source); | 26 Object.assign(target, source); |
| 29 assertEquals({0: "a", 1: "b", 2: "c"}, target); | 27 assertEquals({0: "a", 1: "b", 2: "c"}, target); |
| 30 })(); | 28 })(); |
| OLD | NEW |