@@ -74,6 +74,14 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
74
74
return debugpySettings . object ;
75
75
}
76
76
77
+ function createVariablePresentationMoqConfiguration ( variablePresentation : object ) {
78
+ const debugpySettings = TypeMoq . Mock . ofType < WorkspaceConfiguration > ( ) ;
79
+ debugpySettings
80
+ . setup ( ( p ) => p . get < object > ( 'debugVariablePresentation' , TypeMoq . It . isAny ( ) ) )
81
+ . returns ( ( ) => variablePresentation ) ;
82
+ return debugpySettings . object ;
83
+ }
84
+
77
85
function setupActiveEditor ( fileName : string | undefined , languageId : string ) {
78
86
if ( fileName ) {
79
87
const textEditor = TypeMoq . Mock . ofType < TextEditor > ( ) ;
@@ -566,6 +574,60 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
566
574
} ) ;
567
575
} ) ;
568
576
577
+ const testsForVariablePresentation = [
578
+ {
579
+ variablePresentation : { } ,
580
+ variablePresentationSetting : {
581
+ "class" : "inline"
582
+ } ,
583
+ expectedResult : { } ,
584
+ } ,
585
+ {
586
+ variablePresentation : {
587
+ "class" : "inline"
588
+ } ,
589
+ variablePresentationSetting : {
590
+ "class" : "hide"
591
+ } ,
592
+ expectedResult : {
593
+ "class" : "inline"
594
+ } ,
595
+ } ,
596
+ {
597
+ variablePresentation : undefined ,
598
+ variablePresentationSetting : {
599
+ "class" : "inline"
600
+ } ,
601
+ expectedResult : {
602
+ "class" : "inline"
603
+ } ,
604
+ } ,
605
+ ] ;
606
+ testsForVariablePresentation . forEach ( async ( testParams ) => {
607
+ test ( 'Ensure variablePresentation property is correctly derived from global settings' , async ( ) => {
608
+ const activeFile = 'xyz.py' ;
609
+ const workspaceFolder = createMoqWorkspaceFolder ( __dirname ) ;
610
+ setupActiveEditor ( activeFile , PYTHON_LANGUAGE ) ;
611
+ const defaultWorkspace = path . join ( 'usr' , 'desktop' ) ;
612
+ setupWorkspaces ( [ defaultWorkspace ] ) ;
613
+
614
+ const debugOptions = debugOptionsAvailable
615
+ . slice ( )
616
+ . concat ( DebugOptions . Jinja , DebugOptions . Sudo ) as DebugOptions [ ] ;
617
+
618
+ getConfigurationStub
619
+ . withArgs ( 'debugpy' , sinon . match . any )
620
+ . returns ( createVariablePresentationMoqConfiguration ( testParams . variablePresentationSetting ) ) ;
621
+ const debugConfig = await resolveDebugConfiguration ( workspaceFolder , {
622
+ ...attach ,
623
+ debugOptions,
624
+ variablePresentation : testParams . variablePresentation ,
625
+ } ) ;
626
+ expect ( debugConfig ) . to . have . property ( 'variablePresentation' ) . that . deep . equals ( testParams . expectedResult ) ; // Corrected to use deep.equals
627
+
628
+ } ) ;
629
+ } ) ;
630
+
569
631
test ( 'Send consoleName value to debugpy as consoleTitle' , async ( ) => {
570
632
const activeFile = 'xyz.py' ;
571
633
const consoleName = 'My Console Name' ;
0 commit comments