@@ -218,6 +218,31 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => {
218218 fs . verifyAll ( ) ;
219219 } ) ;
220220
221+ test ( 'Should return ConfigPythonPathDiagnostic if file launch.json contains string "{config:python.interpreterPath}"' , async ( ) => {
222+ const fileContents = 'Hello I am launch.json, I contain string {config:python.interpreterPath}' ;
223+ workspaceService
224+ . setup ( ( w ) => w . hasWorkspaceFolders )
225+ . returns ( ( ) => true )
226+ . verifiable ( TypeMoq . Times . once ( ) ) ;
227+ workspaceService
228+ . setup ( ( w ) => w . workspaceFolders )
229+ . returns ( ( ) => [ workspaceFolder ] )
230+ . verifiable ( TypeMoq . Times . once ( ) ) ;
231+ fs . setup ( ( w ) => w . fileExists ( TypeMoq . It . isAny ( ) ) )
232+ . returns ( ( ) => Promise . resolve ( true ) )
233+ . verifiable ( TypeMoq . Times . once ( ) ) ;
234+ fs . setup ( ( w ) => w . readFile ( TypeMoq . It . isAny ( ) ) )
235+ . returns ( ( ) => Promise . resolve ( fileContents ) )
236+ . verifiable ( TypeMoq . Times . once ( ) ) ;
237+ const diagnostics = await diagnosticService . diagnose ( undefined ) ;
238+ expect ( diagnostics ) . to . be . deep . equal (
239+ [ new InvalidLaunchJsonDebuggerDiagnostic ( DiagnosticCodes . ConfigPythonPathDiagnostic , undefined , false ) ] ,
240+ 'Diagnostics returned are not as expected'
241+ ) ;
242+ workspaceService . verifyAll ( ) ;
243+ fs . verifyAll ( ) ;
244+ } ) ;
245+
221246 test ( 'Should return both diagnostics if file launch.json contains string "debugStdLib" and "pythonExperimental"' , async ( ) => {
222247 const fileContents = 'Hello I am launch.json, I contain both "debugStdLib" and "pythonExperimental"' ;
223248 workspaceService
@@ -471,8 +496,9 @@ suite('Application Diagnostics - Checks if launch.json is invalid', () => {
471496 } ) ;
472497
473498 test ( 'File launch.json is fixed correctly when code equals ConfigPythonPathDiagnostic ' , async ( ) => {
474- const launchJson = 'This string contains {config:python.pythonPath}' ;
475- const correctedlaunchJson = 'This string contains {config:python.interpreterPath}' ;
499+ const launchJson = 'This string contains {config:python.pythonPath} & {config:python.interpreterPath}' ;
500+ const correctedlaunchJson =
501+ 'This string contains {command:python.interpreterPath} & {command:python.interpreterPath}' ;
476502 workspaceService
477503 . setup ( ( w ) => w . hasWorkspaceFolders )
478504 . returns ( ( ) => true )
0 commit comments