@@ -482,7 +482,6 @@ test(`Detects all initialization values correctly. #36`, t => {
482
482
` ) ;
483
483
484
484
const assignments = service . getVariableAssignments ( statements ) ;
485
- console . log ( assignments [ "a" ] ) ;
486
485
t . deepEqual ( assignments [ "a" ] , [ "{" , "..." , "{" , "foo" , ":" , 1 , "}" , "," , "..." , new BindingIdentifier ( "bar" ) , "}" ] ) ;
487
486
} ) ;
488
487
@@ -494,10 +493,27 @@ test(`Detects all initialization values correctly. #37`, t => {
494
493
` ) ;
495
494
496
495
const assignments = service . getVariableAssignments ( statements ) ;
497
- console . log ( assignments [ "a" ] ) ;
498
496
t . deepEqual ( assignments [ "a" ] , [ "[" , "..." , new BindingIdentifier ( "foo" ) , "," , "..." , new BindingIdentifier ( "bar" ) , "]" ] ) ;
499
497
} ) ;
500
498
499
+ test ( `Detects all initialization values correctly. #38` , t => {
500
+ setupMany ( [ [ "AssignmentMap" , "AssignmentMap" ] , [ "statement" , "statement" ] , [ "declarationList" , "declarationList" ] , [ "declarations" , "declarations" ] , [ "declaration" , "declaration" ] , [ "name" , "name" ] , [ "text" , "text" ] , [ "initializer" , "initializer" ] , [ "getInitializedValue" , "getInitializedValue" ] , [ "this" , "this" ] ] ) ;
501
+
502
+ const statements = parse ( `
503
+ const assignmentMap: AssignmentMap = {};
504
+ const declarations = statement.declarationList.declarations;
505
+ const boundName = declaration.name.text;
506
+ const value = this.getInitializedValue(declaration.initializer);
507
+ ` ) ;
508
+
509
+ const assignments = service . getVariableAssignments ( statements ) ;
510
+
511
+ t . deepEqual ( assignments [ "assignmentMap" ] , [ "{" , "}" ] ) ;
512
+ t . deepEqual ( assignments [ "declarations" ] , [ new BindingIdentifier ( "statement.declarationList.declarations" ) ] ) ;
513
+ t . deepEqual ( assignments [ "boundName" ] , [ new BindingIdentifier ( "declaration.name.text" ) ] ) ;
514
+ t . deepEqual ( assignments [ "value" ] , [ new BindingIdentifier ( "this.getInitializedValue" ) , "(" , new BindingIdentifier ( "declaration.initializer" ) , ")" ] ) ;
515
+ } ) ;
516
+
501
517
test ( `Detects all class declarations properly. #1` , t => {
502
518
setup ( ) ;
503
519
const code = `
0 commit comments