@@ -171,22 +171,24 @@ describe("Debug Adapter Tests", function () {
171171 dc . assertStoppedLocation ( 'exception' , expected )
172172 ] ) ;
173173 } ) ;
174-
175- // TODO: Break on a different module
176-
177- // TODO: Step in, step next, ...
178- // TODO: Resume and hit next breakpoint
179- // ...
180174 } )
181175 } )
182176 }
183177
184178 const fetchLocalVars = async ( ) => {
179+ return fetchScopeVars ( "Locals" )
180+ }
181+
182+ const fetchModuleVars = async ( ) => {
183+ return fetchScopeVars ( "Module" )
184+ }
185+
186+ const fetchScopeVars = async ( scopeName ) => {
185187 const stResp = await dc . stackTraceRequest ( { threadId : 0 } ) ;
186188 const sf0 = stResp . body . stackFrames [ 0 ] ;
187189 const scResp = await dc . scopesRequest ( { frameId : sf0 . id } ) ;
188- const localsScope = scResp . body . scopes . find ( scope => scope . name == "Locals" ) ! ! ;
189- const variablesResp = await dc . variablesRequest ( { variablesReference : localsScope . variablesReference } ) ;
190+ const someScope = scResp . body . scopes . find ( scope => scope . name == scopeName ) ! ! ;
191+ const variablesResp = await dc . variablesRequest ( { variablesReference : someScope . variablesReference } ) ;
190192 const variables = variablesResp . body . variables ;
191193 return {
192194 all : variables ,
@@ -462,7 +464,7 @@ describe("Debug Adapter Tests", function () {
462464 assertIsString ( s_labVar , '"label"' ) ;
463465 } )
464466
465- it ( 'newtypes not broken (issue #55)' , async ( ) => {
467+ it ( 'newtype vars not broken (issue #55)' , async ( ) => {
466468 let config = mkConfig ( {
467469 projectRoot : "/data/T55" ,
468470 entryFile : "Main.hs" ,
@@ -487,6 +489,23 @@ describe("Debug Adapter Tests", function () {
487489 const y2_1_1_1_Var = await forceLazy ( y2_1_1_Child . get ( "_1" ) ) ;
488490 assert . strictEqual ( y2_1_1_1_Var . value , 'MyInt 42' ) ;
489491 } )
492+
493+ it ( 'dont crash on inspect newtype con (issue #64)' , async ( ) => {
494+ let config = mkConfig ( {
495+ projectRoot : "/data/T64" ,
496+ entryFile : "Main.hs" ,
497+ entryPoint : "main" ,
498+ entryArgs : [ ] ,
499+ extraGhcArgs : [ ]
500+ } )
501+
502+ const expected = { path : config . projectRoot + "/" + config . entryFile , line : 4 }
503+ await dc . hitBreakpoint ( config , { path : config . entryFile , line : 4 } , expected , expected ) ;
504+
505+ let moduleVars = await fetchModuleVars ( ) ;
506+ const myintCon = await moduleVars . get ( "MyIntCon" )
507+ assert . strictEqual ( myintCon . value , "Data constructor ‘MyIntCon’" )
508+ } )
490509 } )
491510 describe ( "Stepping out (step-out)" , function ( ) {
492511
0 commit comments