Skip to content

Commit 84f857d

Browse files
committed
cleanup: code review
1 parent 1d1c5dc commit 84f857d

File tree

2 files changed

+6
-4
lines changed
  • tests/integration

2 files changed

+6
-4
lines changed

tests/integration/lib/StackTest/Repl.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ module StackTest.Repl
66
, ReplConnection (..)
77
, nextPrompt
88
, replCommand
9+
, replGetChar
910
, replGetLine
1011
, stackRepl
1112
-- * Reexport
1213
, module StackTest
1314
) where
1415

1516
import Control.Exception (SomeException, catch, displayException, finally)
16-
import Control.Monad (unless, when)
17+
import Control.Monad ((>=>), unless, when)
1718
import Control.Monad.IO.Class (liftIO)
1819
import Control.Monad.Trans (lift)
1920
import Control.Monad.Trans.Reader
@@ -53,6 +54,9 @@ replCommand cmd = do
5354
liftIO . putStrLn $ "____> " <> cmd
5455
liftIO $ hPutStrLn replStdinHandle cmd
5556

57+
replGetChar :: Repl Char
58+
replGetChar = asks replStdout >>= liftIO . hGetChar
59+
5660
replGetLine :: Repl String
5761
replGetLine = ask >>= liftIO . hGetLine . replStdout
5862

@@ -100,7 +104,7 @@ runRepl cmd args actions = do
100104
putStrLn "EXCEPTION in test: "
101105
putStrLn . quote $ displayException e
102106
putStrLn "------[ stderr of repl ]------"
103-
withFile stderrBufPath ReadMode $ \h -> hGetContents' h >>= putStr . quote
107+
withFile stderrBufPath ReadMode $ hGetContents' >=> putStr . quote
104108
putStrLn "=============================="
105109
`finally` do
106110
hClose stderrBufHandle

tests/integration/tests/3926-ghci-with-sublibraries/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ main = do
1111
copy "src-internal/Internal.v1" "src-internal/Internal.hs"
1212
stack ["build"] -- need a build before ghci at the moment, see #4148
1313
stackRepl [] $ do
14-
liftIO $ putStrLn "Awaiting prompt..."
1514
nextPrompt
16-
liftIO $ putStrLn "Initial prompt received"
1715
replCommand ":main"
1816
line <- replGetLine
1917
let expected = "hello world"

0 commit comments

Comments
 (0)