@@ -204,7 +204,7 @@ describe("Debug Adapter Tests", function () {
204204 return forcedVar
205205 }
206206
207- const expandVar = async ( v ) => {
207+ const expandVar = async ( v : { variablesReference : number , name : string } ) => {
208208 assert . notStrictEqual ( v . variablesReference , 0 , `Variable ${ v . name } should be expandable (because it is a structure)` ) ;
209209
210210 // Expand a structure (similarly to forcing a lazy variable, but because it is not lazy it will fetch the fields)
@@ -857,5 +857,29 @@ describe("Debug Adapter Tests", function () {
857857 } ) )
858858 } )
859859 } )
860+ describe ( "Evaluate" , function ( ) {
861+ it ( "Return structured representation for evaluated expressions (issue #116)" , async ( ) => {
862+ let config = mkConfig ( {
863+ projectRoot : "/data/T116" ,
864+ entryFile : "T116.hs" ,
865+ entryPoint : "main" ,
866+ entryArgs : [ ] ,
867+ extraGhcArgs : [ ]
868+ } )
869+
870+ const expected = { path : config . projectRoot + "/" + config . entryFile , line : 13 }
871+
872+ await dc . hitBreakpoint ( config , { path : config . entryFile , line : 13 } , expected , expected ) ;
873+
874+ let resp = await dc . evaluateRequest ( { expression : "IM.delete 0 (IM.insert 0 'a' (IM.insert 1 'b' IM.empty))" } )
875+
876+ assert . strictEqual ( resp . body . result , 'Tip' ) ;
877+ const respChild = await expandVar ( { ...resp . body , name : resp . body . result } )
878+ const _1Var = await respChild . get ( "_1" )
879+ const _2Var = await respChild . get ( "_2" )
880+ assert . strictEqual ( _1Var . value , '1' ) ;
881+ assert . strictEqual ( _2Var . value , '\'b\'' ) ;
882+ } )
883+ } )
860884} )
861885
0 commit comments