@@ -27,6 +27,10 @@ basicTests =
2727 , testCase " accepts internalInterpreter launch option" internalInterpreterOption
2828 ]
2929 ]
30+ , testGroup " Multi-module standalone (no cabal/hie.yaml)"
31+ [ testCase " breakpoints in two modules (#297)" multiModuleStandaloneBreakpoints
32+ , testCase " breakpoints in two modules (flipped) (#297)" multiModuleStandaloneBreakpoints2
33+ ]
3034 ]
3135
3236basicForConfig :: TestName -> FilePath -> FilePath -> TestTree
@@ -89,3 +93,37 @@ internalInterpreterOption =
8993 { lcInternalInterpreter = Just True } -- TODO: Automatically run all tests with internal interpreter too?
9094 hitBreakpointWith cfg 6
9195 disconnect
96+
97+ -- | Two-module standalone project (no cabal, no hie.yaml): set a breakpoint in
98+ -- each module, run, hit the first (Main.hs), continue, hit the second (Helper.hs).
99+ -- (#297)
100+ multiModuleStandaloneBreakpoints :: Assertion
101+ multiModuleStandaloneBreakpoints =
102+ withTestDAPServer " test/integration/standalone-multi-module" [] $ \ test_dir server ->
103+ withTestDAPServerClient server $ do
104+ let cfg = mkLaunchConfig test_dir " Main.hs"
105+ _ <- sync $ launchWith cfg
106+ waitFiltering_ EventTy " initialized"
107+ _ <- sync $ setLineBreakpoints test_dir " Main.hs" [7 ]
108+ _ <- sync $ setLineBreakpoints test_dir " Helper.hs" [5 ]
109+ _ <- sync configurationDone
110+ assertStoppedLocation DAP. StoppedEventReasonBreakpoint 7
111+ continueThread 0
112+ assertStoppedLocation DAP. StoppedEventReasonBreakpoint 5
113+ disconnect
114+
115+ -- | Same as above, but flip the order of the setLineBreakpoints calls (#297)
116+ multiModuleStandaloneBreakpoints2 :: Assertion
117+ multiModuleStandaloneBreakpoints2 =
118+ withTestDAPServer " test/integration/standalone-multi-module" [] $ \ test_dir server ->
119+ withTestDAPServerClient server $ do
120+ let cfg = mkLaunchConfig test_dir " Main.hs"
121+ _ <- sync $ launchWith cfg
122+ waitFiltering_ EventTy " initialized"
123+ _ <- sync $ setLineBreakpoints test_dir " Helper.hs" [5 ]
124+ _ <- sync $ setLineBreakpoints test_dir " Main.hs" [7 ]
125+ _ <- sync configurationDone
126+ assertStoppedLocation DAP. StoppedEventReasonBreakpoint 7
127+ continueThread 0
128+ assertStoppedLocation DAP. StoppedEventReasonBreakpoint 5
129+ disconnect
0 commit comments