File tree 2 files changed +28
-0
lines changed
test/cases/parsing/issue-7335
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ export default 9 ;
Original file line number Diff line number Diff line change
1
+ import x from "./a" ;
2
+
3
+ const sum1 = ( x , y , total = x + y ) => total ;
4
+ const id1 = ( a = x ) => a ;
5
+
6
+ function sum2 ( x , y , total = x + y ) { return total ; }
7
+ function id2 ( a = x ) { return a ; }
8
+
9
+ const sum3 = function ( x , y , total = x + y ) { return total ; }
10
+ const id3 = function ( a = x ) { return a ; }
11
+
12
+ it ( "should shadow imported bindings" , ( ) => {
13
+ // Arrow functions
14
+ expect ( sum1 ( 2 , 3 ) ) . toBe ( 5 ) ;
15
+ expect ( id1 ( 1 ) ) . toBe ( 1 ) ;
16
+ expect ( id1 ( ) ) . toBe ( 9 ) ;
17
+
18
+ // Function declarations
19
+ expect ( sum2 ( 2 , 3 ) ) . toBe ( 5 ) ;
20
+ expect ( id2 ( 1 ) ) . toBe ( 1 ) ;
21
+ expect ( id2 ( ) ) . toBe ( 9 ) ;
22
+
23
+ // Function expressions
24
+ expect ( sum3 ( 2 , 3 ) ) . toBe ( 5 ) ;
25
+ expect ( id3 ( 1 ) ) . toBe ( 1 ) ;
26
+ expect ( id3 ( ) ) . toBe ( 9 ) ;
27
+ } ) ;
You can’t perform that action at this time.
0 commit comments