Skip to content

Commit 47f8bd8

Browse files
committed
Added test for issue 884.
1 parent 574fc77 commit 47f8bd8

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

test/es6/proxy-issue884.baseline

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
has
2+
has
3+
has
4+
has
5+
has
6+
has
7+
PASS

test/es6/proxy-issue884.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
var proxyHandler = {
7+
has() { WScript.Echo("has"); return true; }
8+
};
9+
var p = new Proxy({}, proxyHandler);
10+
var obj = {};
11+
12+
try {
13+
Object.defineProperty(obj, "x", p);
14+
} catch (e) {
15+
if (e instanceof TypeError) {
16+
if (e.message !== "Invalid property descriptor: cannot both specify accessors and a 'value' attribute") {
17+
print('FAIL');
18+
} else {
19+
print('PASS');
20+
}
21+
} else {
22+
print('FAIL');
23+
}
24+
}

test/es6/proxytest9.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function test2() {
4545
print('Expected to throw TypeError');
4646
} catch (e) {
4747
if (e instanceof TypeError) {
48-
if (e.message !== 'Property cannot have both accessors and a value') {
48+
if (e.message !== "Invalid property descriptor: cannot both specify accessors and a 'value' attribute") {
4949
print('FAIL');
5050
}
5151
} else {

test/es6/rlexe.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,12 @@
688688
<compile-flags>-args summary -endargs</compile-flags>
689689
</default>
690690
</test>
691+
<test>
692+
<default>
693+
<files>proxy-issue884.js</files>
694+
<baseline>proxy-issue884.baseline</baseline>
695+
</default>
696+
</test>
691697
<test>
692698
<default>
693699
<files>object-is.js</files>

0 commit comments

Comments
 (0)