|
| 1 | +{-# LANGUAGE OverloadedStrings #-} |
| 2 | + |
| 3 | +module FunctionalBadProjectSpec where |
| 4 | + |
| 5 | +import Control.Lens hiding (List) |
| 6 | +import Control.Monad.IO.Class |
| 7 | +import qualified Data.Text as T |
| 8 | +import Language.Haskell.LSP.Test hiding (message) |
| 9 | +import Language.Haskell.LSP.Types as LSP |
| 10 | +import Language.Haskell.LSP.Types.Lens as LSP hiding (contents, error ) |
| 11 | +import Test.Hspec |
| 12 | +import TestUtils |
| 13 | +import Utils |
| 14 | + |
| 15 | +-- --------------------------------------------------------------------- |
| 16 | + |
| 17 | +spec :: Spec |
| 18 | +spec = describe "behaviour on malformed projects" $ do |
| 19 | + it "deals with cabal file with unsatisfiable dependency" $ |
| 20 | + runSession hieCommandExamplePlugin codeActionSupportCaps "test/testdata/badProjects/cabal" $ do |
| 21 | + -- runSessionWithConfig logConfig hieCommandExamplePlugin codeActionSupportCaps "test/testdata" $ do |
| 22 | + _doc <- openDoc "Foo.hs" "haskell" |
| 23 | + |
| 24 | + diags@(d:_) <- waitForDiagnosticsSource "ghcmod" |
| 25 | + -- liftIO $ show diags `shouldBe` "" |
| 26 | + -- liftIO $ putStrLn $ show diags |
| 27 | + -- liftIO $ putStrLn "a" |
| 28 | + liftIO $ do |
| 29 | + length diags `shouldBe` 1 |
| 30 | + d ^. range `shouldBe` Range (Position 0 0) (Position 1 0) |
| 31 | + d ^. severity `shouldBe` (Just DsError) |
| 32 | + d ^. code `shouldBe` Nothing |
| 33 | + d ^. source `shouldBe` Just "ghcmod" |
| 34 | + d ^. message `shouldBe` |
| 35 | + (T.pack "readCreateProcess: stack \"build\" \"--only-configure\" \".\" (exit 1): failed\n") |
| 36 | + |
| 37 | + -- --------------------------------- |
| 38 | + |
| 39 | +-- --------------------------------------------------------------------- |
0 commit comments