File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
graal-js/src/com.oracle.truffle.js.test/js Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ( ) ) ;
You can’t perform that action at this time.
0 commit comments