From 1d0024e6de1743f3b9cd8e3bf87bf95714ac783e Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Sat, 15 Jun 2019 10:15:47 +0200 Subject: [PATCH 1/6] Fix the HieWrapper tests for stack 2.1.1 --- .gitignore | 5 +++- test/testdata/wrapper/8.2.1/Setup.hs | 2 ++ test/testdata/wrapper/8.2.1/cabal.project | 1 + test/testdata/wrapper/8.2.1/cabal1.cabal | 25 +++++++++++++++++++ test/testdata/wrapper/8.2.1/src/Foo/Bar.hs | 3 +++ test/testdata/wrapper/8.2.1/src/main.hs | 7 ++++++ test/testdata/wrapper/lts-11.14/Setup.hs | 2 ++ test/testdata/wrapper/lts-11.14/cabal.project | 1 + test/testdata/wrapper/lts-11.14/cabal1.cabal | 25 +++++++++++++++++++ .../testdata/wrapper/lts-11.14/src/Foo/Bar.hs | 3 +++ test/testdata/wrapper/lts-11.14/src/main.hs | 7 ++++++ test/wrapper/HieWrapper.hs | 2 +- 12 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 test/testdata/wrapper/8.2.1/Setup.hs create mode 100644 test/testdata/wrapper/8.2.1/cabal.project create mode 100644 test/testdata/wrapper/8.2.1/cabal1.cabal create mode 100644 test/testdata/wrapper/8.2.1/src/Foo/Bar.hs create mode 100644 test/testdata/wrapper/8.2.1/src/main.hs create mode 100644 test/testdata/wrapper/lts-11.14/Setup.hs create mode 100644 test/testdata/wrapper/lts-11.14/cabal.project create mode 100644 test/testdata/wrapper/lts-11.14/cabal1.cabal create mode 100644 test/testdata/wrapper/lts-11.14/src/Foo/Bar.hs create mode 100644 test/testdata/wrapper/lts-11.14/src/main.hs diff --git a/.gitignore b/.gitignore index 8b4bf35b5..90a09f165 100644 --- a/.gitignore +++ b/.gitignore @@ -69,4 +69,7 @@ test-results/ .vscode # shake build information -_build/ \ No newline at end of file +_build/ + +# stack 2.1 stack.yaml lock files +stack*.yaml.lock diff --git a/test/testdata/wrapper/8.2.1/Setup.hs b/test/testdata/wrapper/8.2.1/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/test/testdata/wrapper/8.2.1/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/test/testdata/wrapper/8.2.1/cabal.project b/test/testdata/wrapper/8.2.1/cabal.project new file mode 100644 index 000000000..e6fdbadb4 --- /dev/null +++ b/test/testdata/wrapper/8.2.1/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/test/testdata/wrapper/8.2.1/cabal1.cabal b/test/testdata/wrapper/8.2.1/cabal1.cabal new file mode 100644 index 000000000..f599b3df0 --- /dev/null +++ b/test/testdata/wrapper/8.2.1/cabal1.cabal @@ -0,0 +1,25 @@ +-- Initial cabal1.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +name: cabal1 +version: 0.1.0.0 +-- synopsis: +-- description: +license: PublicDomain +-- license-file: LICENSE +author: Alan Zimmerman +maintainer: alan.zimm@gmail.com +-- copyright: +-- category: +build-type: Simple +-- extra-source-files: +-- cabal-helper for cabal 2.2/GHC 8.4 needs a cabal version >= 2 +cabal-version: >=2.0 + +executable cabal1 + main-is: main.hs + -- other-modules: + -- other-extensions: + build-depends: base >=4.6 && <5 + hs-source-dirs: src + default-language: Haskell2010 \ No newline at end of file diff --git a/test/testdata/wrapper/8.2.1/src/Foo/Bar.hs b/test/testdata/wrapper/8.2.1/src/Foo/Bar.hs new file mode 100644 index 000000000..ceb08691b --- /dev/null +++ b/test/testdata/wrapper/8.2.1/src/Foo/Bar.hs @@ -0,0 +1,3 @@ +module Foo.Bar where + +baz = 6 diff --git a/test/testdata/wrapper/8.2.1/src/main.hs b/test/testdata/wrapper/8.2.1/src/main.hs new file mode 100644 index 000000000..839d10429 --- /dev/null +++ b/test/testdata/wrapper/8.2.1/src/main.hs @@ -0,0 +1,7 @@ +-- | Testing that HaRe can find source files from a cabal file + +import qualified Foo.Bar as B + +main = putStrLn "foo" + +baz = 3 + B.baz diff --git a/test/testdata/wrapper/lts-11.14/Setup.hs b/test/testdata/wrapper/lts-11.14/Setup.hs new file mode 100644 index 000000000..9a994af67 --- /dev/null +++ b/test/testdata/wrapper/lts-11.14/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/test/testdata/wrapper/lts-11.14/cabal.project b/test/testdata/wrapper/lts-11.14/cabal.project new file mode 100644 index 000000000..e6fdbadb4 --- /dev/null +++ b/test/testdata/wrapper/lts-11.14/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/test/testdata/wrapper/lts-11.14/cabal1.cabal b/test/testdata/wrapper/lts-11.14/cabal1.cabal new file mode 100644 index 000000000..f599b3df0 --- /dev/null +++ b/test/testdata/wrapper/lts-11.14/cabal1.cabal @@ -0,0 +1,25 @@ +-- Initial cabal1.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/ + +name: cabal1 +version: 0.1.0.0 +-- synopsis: +-- description: +license: PublicDomain +-- license-file: LICENSE +author: Alan Zimmerman +maintainer: alan.zimm@gmail.com +-- copyright: +-- category: +build-type: Simple +-- extra-source-files: +-- cabal-helper for cabal 2.2/GHC 8.4 needs a cabal version >= 2 +cabal-version: >=2.0 + +executable cabal1 + main-is: main.hs + -- other-modules: + -- other-extensions: + build-depends: base >=4.6 && <5 + hs-source-dirs: src + default-language: Haskell2010 \ No newline at end of file diff --git a/test/testdata/wrapper/lts-11.14/src/Foo/Bar.hs b/test/testdata/wrapper/lts-11.14/src/Foo/Bar.hs new file mode 100644 index 000000000..ceb08691b --- /dev/null +++ b/test/testdata/wrapper/lts-11.14/src/Foo/Bar.hs @@ -0,0 +1,3 @@ +module Foo.Bar where + +baz = 6 diff --git a/test/testdata/wrapper/lts-11.14/src/main.hs b/test/testdata/wrapper/lts-11.14/src/main.hs new file mode 100644 index 000000000..839d10429 --- /dev/null +++ b/test/testdata/wrapper/lts-11.14/src/main.hs @@ -0,0 +1,7 @@ +-- | Testing that HaRe can find source files from a cabal file + +import qualified Foo.Bar as B + +main = putStrLn "foo" + +baz = 3 + B.baz diff --git a/test/wrapper/HieWrapper.hs b/test/wrapper/HieWrapper.hs index ba18ccf79..f17e4cf49 100644 --- a/test/wrapper/HieWrapper.hs +++ b/test/wrapper/HieWrapper.hs @@ -18,4 +18,4 @@ main = hspec $ withCurrentDirectory "test/testdata/wrapper/ghc" $ do ghcDisplayVer <- readCreateProcess (shell "ghc --version") "" ghcVer <- getProjectGhcVersion - init ghcDisplayVer `shouldEndWith` ghcVer \ No newline at end of file + init ghcDisplayVer `shouldEndWith` ghcVer From 426712a2398d02127888438e77d0ce1f5345255e Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Sat, 15 Jun 2019 12:48:07 +0200 Subject: [PATCH 2/6] More tests pass --- test/functional/FunctionalCodeActionsSpec.hs | 2 +- test/testdata/addPackageTest/hybrid-exe/package.yaml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/functional/FunctionalCodeActionsSpec.hs b/test/functional/FunctionalCodeActionsSpec.hs index 1bd5d3747..f25345d88 100644 --- a/test/functional/FunctionalCodeActionsSpec.hs +++ b/test/functional/FunctionalCodeActionsSpec.hs @@ -293,7 +293,7 @@ spec = describe "code actions" $ do contents <- getDocumentEdit . TextDocumentIdentifier =<< getDocUri "package.yaml" liftIO $ - T.lines contents !! 21 `shouldSatisfy` T.isSuffixOf "zlib" + T.lines contents !! 23 `shouldSatisfy` T.isSuffixOf "zlib" -- ----------------------------------- diff --git a/test/testdata/addPackageTest/hybrid-exe/package.yaml b/test/testdata/addPackageTest/hybrid-exe/package.yaml index 8d9524972..8a03b67e9 100644 --- a/test/testdata/addPackageTest/hybrid-exe/package.yaml +++ b/test/testdata/addPackageTest/hybrid-exe/package.yaml @@ -21,6 +21,8 @@ description: Please see the README on GitHub at Date: Sat, 15 Jun 2019 18:42:53 +0200 Subject: [PATCH 3/6] Tests still pass with stack 1.9.3 --- haskell-ide-engine.cabal | 1 + src/Haskell/Ide/Engine/Plugin/Base.hs | 25 +++++++- test/unit/PackagePluginSpec.hs | 92 +++++++++++++++++++-------- 3 files changed, 88 insertions(+), 30 deletions(-) diff --git a/haskell-ide-engine.cabal b/haskell-ide-engine.cabal index d30b060a0..8c98c9fd8 100644 --- a/haskell-ide-engine.cabal +++ b/haskell-ide-engine.cabal @@ -95,6 +95,7 @@ library , transformers , unordered-containers , vector + , versions , yaml >= 0.8.31 ghc-options: -Wall -Wredundant-constraints if flag(pedantic) diff --git a/src/Haskell/Ide/Engine/Plugin/Base.hs b/src/Haskell/Ide/Engine/Plugin/Base.hs index cfc544047..0d6ac7f98 100644 --- a/src/Haskell/Ide/Engine/Plugin/Base.hs +++ b/src/Haskell/Ide/Engine/Plugin/Base.hs @@ -15,6 +15,7 @@ import Data.Maybe import Data.Semigroup #endif import qualified Data.Text as T +import qualified Data.Versions as V import Development.GitRev (gitCommitCount) import Distribution.System (buildArch) import Distribution.Text (display) @@ -126,14 +127,34 @@ getProjectGhcVersion = do then tryCommand "ghc --numeric-version" else return "No System GHC found" - tryCommand cmd = - init <$> readCreateProcess (shell cmd) "" + +tryCommand :: String -> IO String +tryCommand cmd = + init <$> readCreateProcess (shell cmd) "" hieGhcVersion :: String hieGhcVersion = VERSION_ghc -- --------------------------------------------------------------------- +getStackVersion :: IO (Maybe V.Version) +getStackVersion = do + isStackInstalled <- isJust <$> findExecutable "stack" + if isStackInstalled + then do + versionStr <- tryCommand "stack --numeric-version" + case V.version (T.pack versionStr) of + Left _err -> return Nothing + Right v -> return (Just v) + else return Nothing + +stack193Version :: V.Version +stack193Version = case V.version "1.9.3" of + Left err -> error $ "stack193Version:err=" ++ show err + Right v -> v + +-- --------------------------------------------------------------------- + checkCabalInstall :: IO Bool checkCabalInstall = isJust <$> findExecutable "cabal" diff --git a/test/unit/PackagePluginSpec.hs b/test/unit/PackagePluginSpec.hs index cc220ef22..be46bdbc0 100644 --- a/test/unit/PackagePluginSpec.hs +++ b/test/unit/PackagePluginSpec.hs @@ -9,6 +9,7 @@ import qualified Data.Aeson as Json import qualified Data.Text as T import qualified Data.HashMap.Strict as H import Haskell.Ide.Engine.MonadTypes +import Haskell.Ide.Engine.Plugin.Base import Haskell.Ide.Engine.Plugin.Package import System.FilePath import System.Directory @@ -243,6 +244,7 @@ packageSpec = do "Add package to package.yaml in hpack project with generated cabal to executable component" $ withCurrentDirectory (testdata "hybrid-exe") $ do + Just stackVersion <- getStackVersion let fp = cwd testdata "hybrid-exe" uri = filePathToUri $ fp "package.yaml" @@ -250,34 +252,68 @@ packageSpec = do act = addCmd' args res = IdeResultOk $ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing - textEdits = List - [ TextEdit (Range (Position 0 0) (Position 34 0)) $ T.concat - [ "library:\n" - , " source-dirs: src\n" - , "copyright: 2018 Author name here\n" - , "maintainer: example@example.com\n" - , "name: asdf\n" - , "version: 0.1.0.0\n" - , "extra-source-files:\n" - , "- README.md\n" - , "- ChangeLog.md\n" - , "author: Author name here\n" - , "github: githubuser/asdf\n" - , "license: BSD3\n" - , "executables:\n" - , " asdf-exe:\n" - , " source-dirs: app\n" - , " main: Main.hs\n" - , " ghc-options:\n" - , " - -threaded\n" - , " - -rtsopts\n" - , " - -with-rtsopts=-N\n" - , " dependencies:\n" - , " - zlib\n" - , " - asdf\n" - , "description: Please see the README on GitHub at \n" - ] - ] + textEdits = if stackVersion <= stack193Version + then + List + [ TextEdit (Range (Position 0 0) (Position 37 0)) $ T.concat + [ "library:\n" + , " source-dirs: src\n" + , " dependencies:\n" + , " - base\n" + , "copyright: 2018 Author name here\n" + , "maintainer: example@example.com\n" + , "name: asdf\n" + , "version: 0.1.0.0\n" + , "extra-source-files:\n" + , "- README.md\n" + , "- ChangeLog.md\n" + , "author: Author name here\n" + , "github: githubuser/asdf\n" + , "license: BSD3\n" + , "executables:\n" + , " asdf-exe:\n" + , " source-dirs: app\n" + , " main: Main.hs\n" + , " ghc-options:\n" + , " - -threaded\n" + , " - -rtsopts\n" + , " - -with-rtsopts=-N\n" + , " dependencies:\n" + , " - zlib\n" + , " - base\n" + , " - asdf\n" + , "description: Please see the README on GitHub at \n" + ] + ] + else + List + [ TextEdit (Range (Position 0 0) (Position 34 0)) $ T.concat + [ "library:\n" + , " source-dirs: src\n" + , "copyright: 2018 Author name here\n" + , "maintainer: example@example.com\n" + , "name: asdf\n" + , "version: 0.1.0.0\n" + , "extra-source-files:\n" + , "- README.md\n" + , "- ChangeLog.md\n" + , "author: Author name here\n" + , "github: githubuser/asdf\n" + , "license: BSD3\n" + , "executables:\n" + , " asdf-exe:\n" + , " source-dirs: app\n" + , " main: Main.hs\n" + , " ghc-options:\n" + , " - -threaded\n" + , " - -rtsopts\n" + , " - -with-rtsopts=-N\n" + , " dependencies:\n" + , " - zlib\n" + , " - asdf\n" + , "description: Please see the README on GitHub at \n" + ] + ] testCommand testPlugins act "package" "add" args res it "Add package to package.yaml in hpack project with generated cabal to library component" $ withCurrentDirectory (testdata "hybrid-lib") From 0e7f9864c83f92f11b2d2be20c3d648aa1ca5f55 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Sat, 15 Jun 2019 21:07:32 +0200 Subject: [PATCH 4/6] Fix package plugin test, for old and new stack --- test/unit/PackagePluginSpec.hs | 35 +--------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/test/unit/PackagePluginSpec.hs b/test/unit/PackagePluginSpec.hs index be46bdbc0..e1a0fdbc6 100644 --- a/test/unit/PackagePluginSpec.hs +++ b/test/unit/PackagePluginSpec.hs @@ -9,7 +9,6 @@ import qualified Data.Aeson as Json import qualified Data.Text as T import qualified Data.HashMap.Strict as H import Haskell.Ide.Engine.MonadTypes -import Haskell.Ide.Engine.Plugin.Base import Haskell.Ide.Engine.Plugin.Package import System.FilePath import System.Directory @@ -244,7 +243,6 @@ packageSpec = do "Add package to package.yaml in hpack project with generated cabal to executable component" $ withCurrentDirectory (testdata "hybrid-exe") $ do - Just stackVersion <- getStackVersion let fp = cwd testdata "hybrid-exe" uri = filePathToUri $ fp "package.yaml" @@ -252,9 +250,7 @@ packageSpec = do act = addCmd' args res = IdeResultOk $ WorkspaceEdit (Just $ H.singleton uri textEdits) Nothing - textEdits = if stackVersion <= stack193Version - then - List + textEdits = List [ TextEdit (Range (Position 0 0) (Position 37 0)) $ T.concat [ "library:\n" , " source-dirs: src\n" @@ -285,35 +281,6 @@ packageSpec = do , "description: Please see the README on GitHub at \n" ] ] - else - List - [ TextEdit (Range (Position 0 0) (Position 34 0)) $ T.concat - [ "library:\n" - , " source-dirs: src\n" - , "copyright: 2018 Author name here\n" - , "maintainer: example@example.com\n" - , "name: asdf\n" - , "version: 0.1.0.0\n" - , "extra-source-files:\n" - , "- README.md\n" - , "- ChangeLog.md\n" - , "author: Author name here\n" - , "github: githubuser/asdf\n" - , "license: BSD3\n" - , "executables:\n" - , " asdf-exe:\n" - , " source-dirs: app\n" - , " main: Main.hs\n" - , " ghc-options:\n" - , " - -threaded\n" - , " - -rtsopts\n" - , " - -with-rtsopts=-N\n" - , " dependencies:\n" - , " - zlib\n" - , " - asdf\n" - , "description: Please see the README on GitHub at \n" - ] - ] testCommand testPlugins act "package" "add" args res it "Add package to package.yaml in hpack project with generated cabal to library component" $ withCurrentDirectory (testdata "hybrid-lib") From 96550a7814d06ce9bac65da1aa0c98f0cf264ee8 Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Sun, 16 Jun 2019 10:31:38 +0200 Subject: [PATCH 5/6] Hacky way to bring in the expected GHC environment file result --- test/unit/GhcModPluginSpec.hs | 10 ++++++++-- test/utils/TestUtils.hs | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/unit/GhcModPluginSpec.hs b/test/unit/GhcModPluginSpec.hs index 0a413d652..6a87d0e25 100644 --- a/test/unit/GhcModPluginSpec.hs +++ b/test/unit/GhcModPluginSpec.hs @@ -9,7 +9,7 @@ import qualified Data.Map as Map -- import Data.Monoid #endif import qualified Data.Set as S --- import qualified Data.Text as T +import qualified Data.Text as T import Haskell.Ide.Engine.Ghc import Haskell.Ide.Engine.MonadTypes import Haskell.Ide.Engine.Plugin.GhcMod @@ -44,8 +44,14 @@ ghcmodSpec = fp <- makeAbsolute "./FileWithWarning.hs" let act = setTypecheckedModule arg arg = filePathToUri fp + IdeResultOk (_,env) <- runSingle testPlugins act + case env of + [] -> return () + [s] -> T.unpack s `shouldStartWith` "Loaded package environment from" + ss -> fail $ "got:" ++ show ss + let res = IdeResultOk $ - (Map.singleton arg (S.singleton diag), []) + (Map.singleton arg (S.singleton diag), env) diag = Diagnostic (Range (toPos (4,7)) (toPos (4,8))) (Just DsError) diff --git a/test/utils/TestUtils.hs b/test/utils/TestUtils.hs index 91ffc3203..f1137f2f2 100644 --- a/test/utils/TestUtils.hs +++ b/test/utils/TestUtils.hs @@ -5,6 +5,7 @@ module TestUtils , withFileLogging , setupStackFiles , testCommand + , runSingle , runSingleReq , makeRequest , runIGM @@ -60,6 +61,9 @@ testCommand testPlugins act plugin cmd arg res = do newApiRes `shouldBe` res fmap fromDynJSON oldApiRes `shouldBe` fmap Just res +runSingle :: IdePlugins -> IdeGhcM (IdeResult b) -> IO (IdeResult b) +runSingle testPlugins act = runIGM testPlugins act + runSingleReq :: ToJSON a => IdePlugins -> PluginId -> CommandName -> a -> IO (IdeResult DynamicJSON) runSingleReq testPlugins plugin com arg = runIGM testPlugins (makeRequest plugin com arg) From 837983ee9c7f3f396863aa58a71a2966c7618cca Mon Sep 17 00:00:00 2001 From: Alan Zimmerman Date: Sun, 16 Jun 2019 13:27:32 +0200 Subject: [PATCH 6/6] Only run the 'liquid' exe during func-tests Otherwise it fails when running with stack > 2.1 --- src/Haskell/Ide/Engine/Plugin/Liquid.hs | 7 ++++--- test/unit/LiquidSpec.hs | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Haskell/Ide/Engine/Plugin/Liquid.hs b/src/Haskell/Ide/Engine/Plugin/Liquid.hs index d46606254..5d01c854d 100644 --- a/src/Haskell/Ide/Engine/Plugin/Liquid.hs +++ b/src/Haskell/Ide/Engine/Plugin/Liquid.hs @@ -156,7 +156,7 @@ generateDiagnosics cb uri file = do -- --------------------------------------------------------------------- --- Find and run the liquid haskell executable +-- | Find and run the liquid haskell executable runLiquidHaskell :: FilePath -> IO (Maybe (ExitCode,[String])) runLiquidHaskell fp = do mexe <- findExecutable "liquid" @@ -168,13 +168,14 @@ runLiquidHaskell fp = do let cmd = lh ++ " --json \"" ++ fp ++ "\"" dir = takeDirectory fp cp = (shell cmd) { cwd = Just dir } - logm $ "runLiquidHaskell:cmd=[" ++ cmd ++ "]" + -- logm $ "runLiquidHaskell:cmd=[" ++ cmd ++ "]" mpp <- lookupEnv "GHC_PACKAGE_PATH" + -- logm $ "runLiquidHaskell:mpp=[" ++ show mpp ++ "]" (ec,o,e) <- bracket (unsetEnv "GHC_PACKAGE_PATH") (\_ -> mapM_ (setEnv "GHC_PACKAGE_PATH") mpp) (\_ -> readCreateProcessWithExitCode cp "") - logm $ "runLiquidHaskell:v=" ++ show (ec,o,e) + -- logm $ "runLiquidHaskell:v=" ++ show (ec,o,e) return $ Just (ec,[o,e]) -- --------------------------------------------------------------------- diff --git a/test/unit/LiquidSpec.hs b/test/unit/LiquidSpec.hs index 1945c89c2..763ff967a 100644 --- a/test/unit/LiquidSpec.hs +++ b/test/unit/LiquidSpec.hs @@ -4,7 +4,6 @@ module LiquidSpec where import Data.Aeson import qualified Data.ByteString.Lazy as BS -import Data.List import qualified Data.Text as T import qualified Data.Text.IO as T import Data.Monoid ((<>)) @@ -12,7 +11,6 @@ import Data.Maybe (isJust) import Haskell.Ide.Engine.MonadTypes import Haskell.Ide.Engine.Plugin.Liquid import System.Directory -import System.Exit import System.FilePath import Test.Hspec @@ -25,18 +23,23 @@ spec = do cwd <- runIO getCurrentDirectory -- --------------------------------- + it "finds liquid haskell exe in $PATH" $ findExecutable "liquid" >>= (`shouldSatisfy` isJust) -- --------------------------------- - -- This produces some products in /test/testdata/liquid/.liquid/ that is used in subsequent test - it "runs the liquid haskell exe" $ do - let - fp = cwd "test/testdata/liquid/Evens.hs" - -- fp = "/home/alanz/tmp/haskell-proc-play/Evens.hs" - -- uri = filePathToUri fp - Just (ef, (msg:_)) <- runLiquidHaskell fp - msg `shouldSatisfy` isPrefixOf "RESULT\n[{\"start\":{\"line\":9,\"column\":1},\"stop\":{\"line\":9,\"column\":8},\"message\":\"Error: Liquid Type Mismatch\\n Inferred type\\n VV : {v : Int | v == (7 : int)}\\n \\n not a subtype of Required type\\n VV : {VV : Int | VV mod 2 == 0}\\n" - ef `shouldBe` ExitFailure 1 + + -- AZ: this test has been moved to func-tests, stack > 2.1 sets + -- its own package environment, we can't run it from here. + + -- -- This produces some products in /test/testdata/liquid/.liquid/ that is used in subsequent test + -- it "runs the liquid haskell exe" $ do + -- let + -- fp = cwd "test/testdata/liquid/Evens.hs" + -- -- fp = "/home/alanz/tmp/haskell-proc-play/Evens.hs" + -- -- uri = filePathToUri fp + -- Just (ef, (msg:_)) <- runLiquidHaskell fp + -- msg `shouldSatisfy` isPrefixOf "RESULT\n[{\"start\":{\"line\":9,\"column\":1},\"stop\":{\"line\":9,\"column\":8},\"message\":\"Error: Liquid Type Mismatch\\n Inferred type\\n VV : {v : Int | v == (7 : int)}\\n \\n not a subtype of Required type\\n VV : {VV : Int | VV mod 2 == 0}\\n" + -- ef `shouldBe` ExitFailure 1 -- --------------------------------- it "gets annot file paths" $ do