mirror of
https://github.com/NorfairKing/feedback.git
synced 2024-11-22 21:19:52 +03:00
Simple test that feedback is waiting
This commit is contained in:
parent
f7648e94b7
commit
384811ae20
@ -6,7 +6,9 @@ mkDerivation {
|
||||
version = "0.0.0.0";
|
||||
src = ./.;
|
||||
libraryHaskellDepends = [ base feedback path path-io ];
|
||||
testHaskellDepends = [ base feedback sydtest typed-process ];
|
||||
testHaskellDepends = [
|
||||
base feedback path path-io sydtest typed-process
|
||||
];
|
||||
testToolDepends = [ sydtest-discover ];
|
||||
doHaddock = false;
|
||||
homepage = "https://github.com/NorfairKing/feedback#readme";
|
||||
|
@ -50,6 +50,8 @@ test-suite feedback-test
|
||||
base >=4.7 && <5
|
||||
, feedback
|
||||
, feedback-test-harness
|
||||
, path
|
||||
, path-io
|
||||
, sydtest
|
||||
, typed-process
|
||||
default-language: Haskell2010
|
||||
|
@ -30,5 +30,7 @@ tests:
|
||||
dependencies:
|
||||
- feedback
|
||||
- feedback-test-harness
|
||||
- path
|
||||
- path-io
|
||||
- sydtest
|
||||
- typed-process
|
||||
|
@ -1,11 +1,23 @@
|
||||
{-# LANGUAGE NumericUnderscores #-}
|
||||
|
||||
module FeedbackSpec (spec) where
|
||||
|
||||
import Control.Concurrent
|
||||
import Path
|
||||
import System.Process.Typed
|
||||
import Test.Syd
|
||||
import Test.Syd.Path
|
||||
|
||||
spec :: Spec
|
||||
spec = sequential $ do
|
||||
it "can show help text" $ do
|
||||
let cp = setStdout nullStream $ proc "feedback" ["--help"]
|
||||
spec = sequential . tempDirSpec "feedback" $ do
|
||||
it "can show help text" $ \tdir -> do
|
||||
let cp = setStdout nullStream $ setWorkingDir (fromAbsDir tdir) $ proc "feedback" ["--help"]
|
||||
runProcess_ cp :: IO ()
|
||||
pure ()
|
||||
|
||||
it "can start a loop and wait for input" $ \tdir -> do
|
||||
let cp = setStdout nullStream $ setWorkingDir (fromAbsDir tdir) $ proc "feedback" ["echo", "hi"]
|
||||
withProcessTerm cp $ \ph -> do
|
||||
threadDelay 100_000 -- Wait 100 ms
|
||||
-- If the program is still running after 100ms, we assume that it is waiting.
|
||||
mExitCode <- getExitCode ph
|
||||
mExitCode `shouldBe` Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user