File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1+ //-------------------------------------------------------------------------------------------------------
2+ // Copyright (C) Microsoft. All rights reserved.
3+ // Copyright (c) ChakraCore Project Contributors. All rights reserved.
4+ // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
5+ //-------------------------------------------------------------------------------------------------------
6+
7+ // @ts -check
8+
9+ const simpleObj = { null : null , undefined : undefined , something : 42 } ;
10+ Object . freeze ( simpleObj ) ;
11+
12+ // Short-circuiting ignores indexer expression and method args
13+ ( async ( ) => {
14+ simpleObj . nothing ?. [ await Promise . reject ( ) ] ;
15+ simpleObj . null ?. [ await Promise . reject ( ) ] ;
16+ simpleObj . undefined ?. [ await Promise . reject ( ) ] ;
17+ } ) ( ) . then (
18+ ( ) => {
19+ console . log ( "pass" ) ;
20+ } ,
21+ ( x ) => console . log ( x )
22+ ) ;
Original file line number Diff line number Diff line change @@ -59,11 +59,6 @@ const tests = [
5959 assert . isUndefined ( simpleObj . undefined ?. something ( i ++ ) ) ;
6060
6161 assert . strictEqual ( 0 , i , "Indexer may never be evaluated" ) ;
62-
63- // ToDo: How can I run async tests?
64- // simpleObj.nothing?.[await Promise.reject()];
65- // simpleObj.null?.[await Promise.reject()];
66- // simpleObj.undefined?.[await Promise.reject()];
6762 }
6863 } ,
6964 {
Original file line number Diff line number Diff line change 1313 <files >optional-calls.js</files >
1414 <compile-flags >-args summary -endargs</compile-flags >
1515 </default >
16+ <default >
17+ <files >optional-async.js</files >
18+ <compile-flags >-args summary -endargs</compile-flags >
19+ </default >
1620 </test >
1721</regress-exe >
You can’t perform that action at this time.
0 commit comments