Skip to content

Commit fc9c85f

Browse files
committed
Adding a regression test of writing of hash entries in strict mode.
1 parent 129c1a7 commit fc9c85f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
// Tests writing of hash/map entries. It used to throw TypeError
9+
// in strict mode, see https://github.com/oracle/graaljs/issues/522
10+
11+
load('assert.js');
12+
13+
assertSame(42, (function() {
14+
var map = new java.util.HashMap();
15+
map.x = 42;
16+
return map.x;
17+
})());
18+
19+
assertSame(43, (function() {
20+
var map = new java.util.HashMap();
21+
map['x'] = 43;
22+
return map['x'];
23+
})());
24+
25+
assertSame(44, (function() {
26+
"use strict";
27+
var map = new java.util.HashMap();
28+
map.x = 44;
29+
return map.x;
30+
})());
31+
32+
assertSame(45, (function() {
33+
"use strict";
34+
var map = new java.util.HashMap();
35+
map['x'] = 45;
36+
return map['x'];
37+
})());

0 commit comments

Comments
 (0)