@@ -19,6 +19,7 @@ import { PYTHON_PATH, sleep } from '../common';
1919import { IS_MULTI_ROOT_TEST , TEST_DEBUGGER } from '../initialize' ;
2020import { DEBUGGER_TIMEOUT } from './common/constants' ;
2121import { DebugClientEx } from './debugClient' ;
22+ import { continueDebugging } from './utils' ;
2223
2324const isProcessRunning = require ( 'is-running' ) as ( number ) = > boolean ;
2425
@@ -539,5 +540,33 @@ let testCounter = 0;
539540 expect ( stackframes . body . stackFrames [ 2 ] . line ) . to . be . equal ( 10 ) ;
540541 expect ( fileSystem . arePathsSame ( stackframes . body . stackFrames [ 2 ] . source ! . path ! , pythonFile ) ) . to . be . equal ( true , 'paths do not match' ) ;
541542 } ) ;
543+ test ( 'Test Evaluation of Expressions' , async function ( ) {
544+ if ( debuggerType !== 'pythonExperimental' ) {
545+ return this . skip ( ) ;
546+ }
547+
548+ const breakpointLocation = { path : path . join ( debugFilesPath , 'sample2WithoutSleep.py' ) , column : 1 , line : 5 } ;
549+ const breakpointArgs = {
550+ lines : [ breakpointLocation . line ] ,
551+ breakpoints : [ { line : breakpointLocation . line , column : breakpointLocation . column } ] ,
552+ source : { path : breakpointLocation . path }
553+ } ;
554+ await Promise . all ( [
555+ debugClient . launch ( buildLauncArgs ( 'sample2WithoutSleep.py' , false ) ) ,
556+ debugClient . waitForEvent ( 'initialized' )
557+ . then ( ( ) => debugClient . setBreakpointsRequest ( breakpointArgs ) )
558+ . then ( ( ) => debugClient . configurationDoneRequest ( ) )
559+ . then ( ( ) => debugClient . threadsRequest ( ) ) ,
560+ debugClient . waitForEvent ( 'thread' ) ,
561+ debugClient . assertStoppedLocation ( 'breakpoint' , breakpointLocation )
562+ ] ) ;
563+
564+ //Do not remove this, this is required to ensure PTVSD is ready to accept other requests.
565+ await debugClient . threadsRequest ( ) ;
566+ const evaluateResponse = await debugClient . evaluateRequest ( { context : 'repl' , expression : 'a+b+2' , frameId : 1 } ) ;
567+ expect ( evaluateResponse . body . type ) . to . equal ( 'int' ) ;
568+ expect ( evaluateResponse . body . result ) . to . equal ( '5' ) ;
569+ await continueDebugging ( debugClient ) ;
570+ } ) ;
542571 } ) ;
543572} ) ;
0 commit comments