Commit c4176b3f authored by Andrew Gibiansky's avatar Andrew Gibiansky

clean

parent 502d90fe
...@@ -11,7 +11,7 @@ import Data.String.Utils (strip, replace) ...@@ -11,7 +11,7 @@ import Data.String.Utils (strip, replace)
import IHaskell.Eval.Parser import IHaskell.Eval.Parser
import IHaskell.Types import IHaskell.Types
import IHaskell.IPython import IHaskell.IPython
import IHaskell.Eval.Evaluate import IHaskell.Eval.Evaluate as Eval
import IHaskell.Eval.Completion import IHaskell.Eval.Completion
import Test.Hspec import Test.Hspec
...@@ -31,7 +31,7 @@ eval string = do ...@@ -31,7 +31,7 @@ eval string = do
outputAccum <- newIORef [] outputAccum <- newIORef []
let publish _ displayDatas = modifyIORef outputAccum (displayDatas :) let publish _ displayDatas = modifyIORef outputAccum (displayDatas :)
getTemporaryDirectory >>= setCurrentDirectory getTemporaryDirectory >>= setCurrentDirectory
interpret $ evaluate 1 string publish interpret $ Eval.evaluate 1 string publish
out <- readIORef outputAccum out <- readIORef outputAccum
return $ reverse out return $ reverse out
...@@ -58,7 +58,7 @@ becomes string expected = do ...@@ -58,7 +58,7 @@ becomes string expected = do
Nothing -> expectationFailure $ "No plain-text output in " ++ show result Nothing -> expectationFailure $ "No plain-text output in " ++ show result
completes string expected = completionTarget newString cursorloc `shouldBe` expected completes string expected = completionTarget newString cursorloc `shouldBe` expected
where (newString, cursorloc) = case findIndex (=='!') string of where (newString, cursorloc) = case elemIndex '!' string of
Nothing -> error "Expected cursor written as '!'." Nothing -> error "Expected cursor written as '!'."
Just idx -> (replace "!" "" string, idx) Just idx -> (replace "!" "" string, idx)
...@@ -69,7 +69,7 @@ completionHas string expected = do ...@@ -69,7 +69,7 @@ completionHas string expected = do
let existsInCompletion = (`elem` completions) let existsInCompletion = (`elem` completions)
unmatched = filter (not . existsInCompletion) expected unmatched = filter (not . existsInCompletion) expected
unmatched `shouldBe` [] unmatched `shouldBe` []
where (newString, cursorloc) = case findIndex (=='!') string of where (newString, cursorloc) = case elemIndex '!' string of
Nothing -> error "Expected cursor written as '!'." Nothing -> error "Expected cursor written as '!'."
Just idx -> (replace "!" "" string, idx) Just idx -> (replace "!" "" string, idx)
......
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