File tree 3 files changed +26
-5
lines changed
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 = [
59
59
assert . isUndefined ( simpleObj . undefined ?. something ( i ++ ) ) ;
60
60
61
61
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()];
67
62
}
68
63
} ,
69
64
{
Original file line number Diff line number Diff line change 13
13
<files >optional-calls.js</files >
14
14
<compile-flags >-args summary -endargs</compile-flags >
15
15
</default >
16
+ <default >
17
+ <files >optional-async.js</files >
18
+ <compile-flags >-args summary -endargs</compile-flags >
19
+ </default >
16
20
</test >
17
21
</regress-exe >
You can’t perform that action at this time.
0 commit comments