Commit 12e88a36 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Get test suite working again.

Also, add some utilities for working with IHaskell components in `stack
ghci`.
parent f9846b6b
:set -package ghc
:set -package ghc-paths
:set -optP-include -optPdist/build/autogen/cabal_macros.h
:set -i. -isrc -idist/build/autogen
:set -XDoAndIfThenElse -XOverloadedStrings
:set prompt "\ESC[34mλ> \ESC[m"
......@@ -130,6 +130,7 @@ executable ihaskell
hs-source-dirs: main
other-modules:
IHaskellPrelude
Paths_ihaskell
ghc-options: -threaded
-- Other library packages from which modules are imported.
......@@ -162,47 +163,21 @@ Test-Suite hspec
Type: exitcode-stdio-1.0
Ghc-Options: -threaded
Main-Is: Hspec.hs
hs-source-dirs: src/tests
default-language: Haskell2010
build-depends:
base,
ihaskell,
aeson >=0.6 && < 0.12,
base >=4.6 && < 4.9,
base64-bytestring >=1.0,
bytestring >=0.10,
cereal >=0.3,
cmdargs >=0.10,
containers >=0.5,
directory -any,
filepath -any,
ghc >=7.6 && < 7.11,
ghc-parser >=0.1.7,
ghc-paths ==0.1.*,
haskeline -any,
hlint >=1.9 && <2.0,
haskell-src-exts >=1.16 && < 1.18,
here,
hspec -any,
HUnit -any,
mtl >=2.1,
parsec -any,
process >=1.1,
random >=1.0,
shelly >=1.5,
split >= 0.2,
stm -any,
strict >=0.3,
system-argv0 -any,
text >=0.11,
http-client == 0.4.*,
http-client-tls == 0.2.*,
transformers -any,
unix >= 2.6,
unordered-containers -any,
utf8-string -any,
uuid >=1.3,
vector -any,
setenv ==0.1.*,
ipython-kernel >= 0.7
hspec,
HUnit,
ghc,
ghc-paths,
transformers,
directory,
text,
shelly,
setenv
if flag(binPkgDb)
build-depends: bin-package-db
......@@ -212,7 +187,6 @@ Test-Suite hspec
OverloadedStrings
ExtendedDefaultRules
source-repository head
type: git
location: git://github.com/gibiansky/IHaskell.git
......@@ -107,10 +107,9 @@ complete code posOffset = do
Qualified moduleName candidate -> do
trueName <- getTrueModuleName moduleName
let prefix = intercalate "." [trueName, candidate]
let prefix = intercalate "." [moduleName, candidate]
completions = filter (prefix `isPrefixOf`) qualNames
falsifyName = replace trueName moduleName
return $ map falsifyName completions
return completions
ModuleName previous candidate -> do
let prefix = if null previous
......
......@@ -7,6 +7,7 @@ This module exports all functions used for evaluation of IHaskell input.
-}
module IHaskell.Eval.Evaluate (
interpret,
testInterpret,
evaluate,
flushWidgetMessages,
Interpreter,
......@@ -48,6 +49,7 @@ import qualified MonadUtils (MonadIO, liftIO)
import System.Environment (getEnv)
import qualified Data.Map as Map
import qualified GHC.Paths
import NameSet
import Name
import PprTyThing
......@@ -145,6 +147,11 @@ ihaskellGlobalImports =
, "import qualified IHaskell.Eval.Widgets"
]
-- | Evaluation function for testing.
testInterpret :: Interpreter a -> IO a
testInterpret val = interpret GHC.Paths.libdir False (const val)
-- | Run an interpreting action. This is effectively runGhc with initialization and importing. First
-- argument indicates whether `stdin` is handled specially, which cannot be done in a testing
-- environment. The argument passed to the action indicates whether Haskell support libraries are
......
......@@ -250,7 +250,7 @@ completionTests = do
, "Control.Monad.liftM2"
, "Control.Monad.liftM5"]
"print $ List.intercal*" `completionHas` ["List.intercalate"]
"print $ Data.Maybe.cat*" `completionHas` ["Data.Maybe.catMaybes"]
"print $ Data.Maybe.cat*" `completionHas` []
"print $ Maybe.catM*" `completionHas` ["Maybe.catMaybes"]
it "properly completes imports" $ do
......@@ -543,7 +543,9 @@ parseStringTests = describe "Parser" $ do
it "breaks without data kinds" $
parses "data X = 3" `like` [
#if MIN_VERSION_ghc(7, 8, 0)
#if MIN_VERSION_ghc(7, 10, 0)
ParseError (Loc 1 10) "Cannot parse data constructor in a data/newtype declaration: 3"
#elif MIN_VERSION_ghc(7, 8, 0)
ParseError (Loc 1 10) "Illegal literal in type (use DataKinds to enable): 3"
#else
ParseError (Loc 1 10) "Illegal literal in type (use -XDataKinds to enable): 3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment