HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Modulesydtest-0.33.0.0Haskell2010

Test.Syd.Def.Scenario

  • 3 values
  • Packagesydtest-0.33.0.0
  • Exports3
  • LanguageHaskell2010
  • LicenceLicenseRef-OtherLicense
  • SourceScenario.hs
valuescenarioDir
  1. :: Path b Dir
  2. -> Path Rel File -> TestDefM outers inner ()
  3. -> TestDefM outers inner ()
#

Define a test for each file in the given directory.

Subdirectories are ignored, use scenarioDirRecur to descend into them or scenarioDirOfDirs to treat each of them as a scenario.

If the directory is empty or absent, this defines a single failing test instead, because that usually means the scenario files were omitted by accident.

The scenario is given relative to the directory, so it is the name to say the test is about and joining it to the directory is what reads it. Neither has to be recovered from the other.

Example:

  let dir = [reldir|test_resources/even|]
  scenarioDir dir $ \rf ->
    it "contains an even number" $ do
      s <- readFile (fromRelFile (dir </> rf))
      n <- readIO s
      (n :: Int) `shouldSatisfy` even
valuescenarioDirRecur
  1. :: Path b Dir
  2. -> Path Rel File -> TestDefM outers inner ()
  3. -> TestDefM outers inner ()
#

Define a test for each file in the given directory, recursively.

If the directory contains no files, or is absent, this defines a single failing test instead, because that usually means the scenario files were omitted by accident.

Example:

  let dir = [reldir|test_resources/odd|]
  scenarioDirRecur dir $ \rf ->
    it "contains an odd number" $ do
      s <- readFile (fromRelFile (dir </> rf))
      n <- readIO s
      (n :: Int) `shouldSatisfy` odd
valuescenarioDirOfDirs
  1. :: Path b Dir
  2. -> Path Rel Dir -> TestDefM outers inner ()
  3. -> TestDefM outers inner ()
#

Define a test for each subdirectory of the given directory.

Use this when a single scenario consists of more than one file. Files in the given directory itself are ignored, and so is any nesting below the subdirectories: each subdirectory is one scenario, whatever it contains.

If there are no subdirectories, or the directory is absent, this defines a single failing test instead, because that usually means the scenarios were omitted by accident.

Example:

  let dir = [reldir|test_resources/same|]
  scenarioDirOfDirs dir $ \rd ->
    it "contains two files with the same contents" $ do
      a <- readFile (fromRelFile (dir </> rd </> [relfile|a|]))
      b <- readFile (fromRelFile (dir </> rd </> [relfile|b|]))
      a `shouldBe` b