Skip to content

Commit e1839b1

Browse files
committed
Add test for #116
1 parent 0c24905 commit e1839b1

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module Main where
2+
3+
import Data.IntMap
4+
import qualified Data.IntMap as IM
5+
6+
main = do
7+
nn (IM.fromList [(0,345),(1,34),(46,345)])
8+
nn (IM.fromList [(0,1)])
9+
nn (IM.fromList [(0,2), (2,4)])
10+
nn (IM.fromList [(0,3)])
11+
12+
nn :: IntMap Int -> IO ()
13+
nn im = do
14+
if False
15+
then return ()
16+
else do
17+
nnn im
18+
return ()
19+
20+
nnn :: IntMap Int -> IO ()
21+
nnn im = do
22+
const (return ()) im

test/integration-tests/test/adapter.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)