blob: 154f8c15f680cef95bbef11483d564181d8c0bcc [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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
7var 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
17var proxy = new Proxy({}, handler);
18
19var o = {};
20
21Object.assign(o, proxy);
22
23assertEquals({"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})();