Skip to content

Commit cf772c6

Browse files
committed
dashed deps test
1 parent 883e1fd commit cf772c6

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

plugins/hls-cabal-plugin/test/Main.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import System.FilePath
2525
import Test.Hls
2626
import Utils
2727

28-
import Debug.Trace
29-
3028
main :: IO ()
3129
main = do
3230
defaultTestRunner $
@@ -227,9 +225,21 @@ codeActionTests = testGroup "Code Actions"
227225
cas <- Maybe.mapMaybe (^? _R) <$> getAllCodeActions hsdoc
228226
let selectedCas = filter (\ca -> "Add dependency" `T.isPrefixOf` (ca ^. L.title)) cas
229227
mapM_ executeCodeAction selectedCas
230-
_ <- skipManyTill anyMessage $ getDocumentEdit cabDoc -- Needed to wait for the changes in cabal file
228+
_ <- skipManyTill anyMessage $ getDocumentEdit cabDoc -- Wait for the changes in cabal file
231229
contents <- documentContents cabDoc
232230
liftIO $ assertEqual "Split isn't found in the cabal file" (Text.indices "split" contents) [256]
231+
, runHaskellTestCaseSession "Code Actions - Can add dashed hidden package" ("cabal-add-testdata" </> "hidden-package-dashed") $ do
232+
hsdoc <- openDoc ("src" </> "Main.hs") "haskell"
233+
cabDoc <- openDoc "hidden-package-dashed.cabal" "cabal"
234+
_ <- waitForDiagnosticsFrom hsdoc
235+
cas <- Maybe.mapMaybe (^? _R) <$> getAllCodeActions hsdoc
236+
let selectedCas = filter (\ca -> "Add dependency" `T.isPrefixOf` (ca ^. L.title)) cas
237+
mapM_ executeCodeAction selectedCas
238+
_ <- skipManyTill anyMessage $ getDocumentEdit cabDoc -- Wait for the changes in cabal file
239+
contents <- documentContents cabDoc
240+
liftIO $ assertEqual "hls-plugin-api isn't found in the cabal file" (Text.indices "hls-plugin-api" contents) [263]
241+
242+
233243
]
234244
where
235245
getLicenseAction :: T.Text -> [Command |? CodeAction] -> [CodeAction]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cabal-version: 2.4
2+
3+
name: hidden-package
4+
version: 0.1.0.0
5+
build-type: Simple
6+
7+
executable hidden-package-dashed
8+
main-is: Main.hs
9+
hs-source-dirs: src
10+
ghc-options: -Wall
11+
build-depends: base
12+
default-language: Haskell2010
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Main where
2+
3+
import Ide.Types
4+
5+
main = putStrLn "Hello, Haskell!"

0 commit comments

Comments
 (0)