OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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-object | |
6 | |
7 // Based on Mozilla Object.assign() tests | 5 // Based on Mozilla Object.assign() tests |
8 | 6 |
9 function checkDataProperty(object, propertyKey, value, writable, enumerable, con
figurable) { | 7 function checkDataProperty(object, propertyKey, value, writable, enumerable, con
figurable) { |
10 var desc = Object.getOwnPropertyDescriptor(object, propertyKey); | 8 var desc = Object.getOwnPropertyDescriptor(object, propertyKey); |
11 assertFalse(desc === undefined); | 9 assertFalse(desc === undefined); |
12 assertTrue('value' in desc); | 10 assertTrue('value' in desc); |
13 assertEquals(desc.value, value); | 11 assertEquals(desc.value, value); |
14 assertEquals(desc.writable, writable); | 12 assertEquals(desc.writable, writable); |
15 assertEquals(desc.enumerable, enumerable); | 13 assertEquals(desc.enumerable, enumerable); |
16 assertEquals(desc.configurable, configurable); | 14 assertEquals(desc.configurable, configurable); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 var ErrorB = function ErrorB() {}; | 131 var ErrorB = function ErrorB() {}; |
134 var log = ""; | 132 var log = ""; |
135 var source = { b: 1, a: 1 }; | 133 var source = { b: 1, a: 1 }; |
136 var target = { | 134 var target = { |
137 set a(v) { log += "a"; throw new ErrorA }, | 135 set a(v) { log += "a"; throw new ErrorA }, |
138 set b(v) { log += "b"; throw new ErrorB }, | 136 set b(v) { log += "b"; throw new ErrorB }, |
139 }; | 137 }; |
140 assertThrows(function() { return Object.assign(target, source); }, ErrorB); | 138 assertThrows(function() { return Object.assign(target, source); }, ErrorB); |
141 assertEquals(log, "b"); | 139 assertEquals(log, "b"); |
142 })(); | 140 })(); |
OLD | NEW |