Skip to content

Commit

Permalink
LauncheSpec - add new tests with different order of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Mar 19, 2019
1 parent 4904d2f commit 82a731a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/unit/Cardano/LauncherSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Test.Hspec
{-# ANN spec ("HLint: ignore Use head" :: String) #-}
spec :: Spec
spec = do
it "One process exits with 0, others are cancelled" $ do
it "1st process exits with 0, others are cancelled" $ do
let commands =
[ Command "./test/data/Launcher/once.sh" ["0"] (pure ())
, Command "./test/data/Launcher/forever.sh" [] (pure ())
Expand All @@ -28,7 +28,25 @@ spec = do
name `shouldBe` cmdName (commands !! 0)
code `shouldBe` ExitSuccess

it "One process exits with 14, others are cancelled" $ do
it "2nd process exits with 0, others are cancelled" $ do
let commands =
[ Command "./test/data/Launcher/forever.sh" [] (pure ())
, Command "./test/data/Launcher/once.sh" ["0"] (pure ())
]
(ProcessHasExited name code) <- launch commands
name `shouldBe` cmdName (commands !! 1)
code `shouldBe` ExitSuccess

it "1st process exits with 14, others are cancelled" $ do
let commands =
[ Command "./test/data/Launcher/once.sh" ["14"] (pure ())
, Command "./test/data/Launcher/forever.sh" [] (pure ())
]
(ProcessHasExited name code) <- launch commands
name `shouldBe` cmdName (commands !! 0)
code `shouldBe` (ExitFailure 14)

it "2nd process exits with 14, others are cancelled" $ do
let commands =
[ Command "./test/data/Launcher/forever.sh" [] (pure ())
, Command "./test/data/Launcher/once.sh" ["14"] (pure ())
Expand Down

0 comments on commit 82a731a

Please sign in to comment.