OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --harmony-proxies |
| 6 |
| 7 var handler = { |
| 8 ownKeys: function(t) { return ["a", "b"]; }, |
| 9 getOwnPropertyDescriptor: function(t, p) { |
| 10 return {enumerable: true, configurable: true} |
| 11 }, |
| 12 get: function(t, p) { |
| 13 return 1; |
| 14 } |
| 15 }; |
| 16 |
| 17 var proxy = new Proxy({}, handler); |
| 18 |
| 19 var o = {}; |
| 20 |
| 21 Object.assign(o, proxy); |
| 22 |
| 23 assertEquals({"a": 1, "b": 1}, o); |
| 24 |
| 25 (function TestStringSources() { |
| 26 var source = "abc"; |
| 27 var target = {}; |
| 28 Object.assign(target, source); |
| 29 assertEquals({0: "a", 1: "b", 2: "c"}, target); |
| 30 })(); |
OLD | NEW |