Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/integration/lib/StackTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ runRepl cmd args actions = do
catch
(hGetChar rStderr >>= hPutChar logFileHandle)
(\e -> unless (isEOFError e) $ throw e)
runReaderT (nextPrompt >> actions) (ReplConnection rStdin rStdout)
runReaderT actions (ReplConnection rStdin rStdout)
waitForProcess ph

repl :: HasCallStack => [String] -> Repl () -> IO ()
Expand Down
22 changes: 15 additions & 7 deletions test/integration/tests/3926-ghci-with-sublibraries/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ import Data.List
import StackTest

main :: IO ()
main = do
stack ["clean"] -- to make sure we can load the code even after a clean
copy "src/Lib.v1" "src/Lib.hs"
copy "src-internal/Internal.v1" "src-internal/Internal.hs"
stack ["build"] -- need a build before ghci at the moment, see #4148
forkIO fileEditingThread
replThread
main
| isWindows =
putStrLn "This test was disabled on Windows on 25 June 2023 (see \
\https://github.com/commercialhaskell/stack/issues/6170)."
| otherwise = do
stack ["clean"] -- to make sure we can load the code even after a clean
copy "src/Lib.v1" "src/Lib.hs"
copy "src-internal/Internal.v1" "src-internal/Internal.hs"
stack ["build"] -- need a build before ghci at the moment, see #4148
forkIO fileEditingThread
replThread

replThread :: IO ()
replThread = repl [] $ do
-- The command must be issued before searching the output for the next prompt,
-- otherwise, on Windows from msys2-20230526, `stack repl` encounters a EOF
-- and terminates gracefully.
replCommand ":main"
nextPrompt
line <- replGetLine
let expected = "hello world"
when (line /= expected) $
Expand Down
24 changes: 14 additions & 10 deletions test/integration/tests/4270-files-order/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import StackTest

main :: IO ()
main = do
stack ["build"]
repl [] $ do
replCommand "putStrLn greeting"
line <- replGetLine
let expected = "Hello, world!"
when (line /= expected) $
error $
"Didn't load correctly.\n"
<> "Expected: " <> expected <> "\n"
<> "Actual : " <> line <> "\n"
stack ["build"]
repl [] $ do
-- The command must be issued before searching the output for the next
-- prompt, otherwise, on Windows from msys2-20230526, `stack repl`
-- encounters a EOF and terminates gracefully.
replCommand "putStrLn greeting"
nextPrompt
line <- replGetLine
let expected = "Hello, world!"
when (line /= expected) $
error $
"Didn't load correctly.\n"
<> "Expected: " <> expected <> "\n"
<> "Actual : " <> line <> "\n"
20 changes: 12 additions & 8 deletions test/integration/tests/module-added-multiple-times/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import StackTest

main :: IO ()
main = repl [] $ do
replCommand ":main"
line <- replGetLine
let expected = "Hello World!"
when (line /= expected) $
error $
"Main module didn't load correctly.\n"
<> "Expected: " <> expected <> "\n"
<> "Actual : " <> line <> "\n"
-- The command must be issued before searching the output for the next prompt,
-- otherwise, on Windows from msys2-20230526, `stack repl` encounters a EOF
-- and terminates gracefully.
replCommand ":main"
nextPrompt
line <- replGetLine
let expected = "Hello World!"
when (line /= expected) $
error $
"Main module didn't load correctly.\n"
<> "Expected: " <> expected <> "\n"
<> "Actual : " <> line <> "\n"