Debian Codegraph @

js/src/tests/test262/harness/verifyProperty-value-error.js

raw
1 // Copyright (C) 2017 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Including propertyHelper.js will expose:
7
8 verifyProperty()
9 ...
10
11 includes: [propertyHelper.js]
12 ---*/
13
14 var threw = false;
15 var object = Object.defineProperty({}, "prop", {
16 value: 1
17 });
18
19 try {
20 verifyProperty(object, "prop", {
21 value: 2
22 });
23 } catch(err) {
24 threw = true;
25 if (err.constructor !== Test262Error) {
26 throw new Error(
27 'Expected a Test262Error, but a "' + err.constructor.name +
28 '" was thrown.'
29 );
30 }
31
32 if (err.message !== "obj['prop'] descriptor value should be 2; obj['prop'] value should be 2") {
33 throw new Error('The error thrown did not define the specified message');
34 }
35 }
36
37 if (threw === false) {
38 throw new Error('Expected a Test262Error, but no error was thrown.');
39 }
40
41 reportCompare(0, 0);