plutus-core-1.30.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Tasty.Extras

Synopsis

Documentation

newtype Layer a r Source #

A monad allowing one to emit elements of type a. Semantically equivalent to Writer (DList a) r, but:

  1. is faster, being based on the Church-encoded free monad
  2. implements Monoid, so that all the Data.Foldable convenience is supported
  3. has better ergonomics as it doesn't require the user to wrap a values into DLists

This type is also semantically equivalent to Stream (Of a) Identity r.

Useful for monadically creating tree-like structures, for example the following

import Data.Tree
yield = embed . pure
main = putStrLn . drawTree . Node "a" . toList $ do
    yield "b"
    nestWith (Node "c") $ do
        yield "d"
        yield "e"
    yield "f"

will produce

-a
|
+- b
|
+- c
|  |
|  +- d
|  |
|  `- e
|
`- f

Constructors

Layer 

Fields

Instances

Instances details
Applicative (Layer a) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

pure ∷ a0 → Layer a a0 Source #

(<*>)Layer a (a0 → b) → Layer a a0 → Layer a b Source #

liftA2 ∷ (a0 → b → c) → Layer a a0 → Layer a b → Layer a c Source #

(*>)Layer a a0 → Layer a b → Layer a b Source #

(<*)Layer a a0 → Layer a b → Layer a a0 Source #

Functor (Layer a) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

fmap ∷ (a0 → b) → Layer a a0 → Layer a b Source #

(<$) ∷ a0 → Layer a b → Layer a a0 Source #

Monad (Layer a) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

(>>=)Layer a a0 → (a0 → Layer a b) → Layer a b Source #

(>>)Layer a a0 → Layer a b → Layer a b Source #

return ∷ a0 → Layer a a0 Source #

MonadFree ((,) a) (Layer a) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

wrap ∷ (a, Layer a a0) → Layer a a0

unit ~ () ⇒ Monoid (Layer a unit) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

memptyLayer a unit Source #

mappendLayer a unit → Layer a unit → Layer a unit Source #

mconcat ∷ [Layer a unit] → Layer a unit Source #

unit ~ () ⇒ Semigroup (Layer a unit) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

(<>)Layer a unit → Layer a unit → Layer a unit Source #

sconcatNonEmpty (Layer a unit) → Layer a unit Source #

stimesIntegral b ⇒ b → Layer a unit → Layer a unit Source #

unit ~ () ⇒ IsList (Layer a unit) Source # 
Instance details

Defined in Test.Tasty.Extras

Associated Types

type Item (Layer a unit) Source #

Methods

fromList ∷ [Item (Layer a unit)] → Layer a unit Source #

fromListNInt → [Item (Layer a unit)] → Layer a unit Source #

toListLayer a unit → [Item (Layer a unit)] Source #

type Item (Layer a unit) Source # 
Instance details

Defined in Test.Tasty.Extras

type Item (Layer a unit) = a

embedMonadFree ((,) a) m ⇒ a → m () Source #

Embed the given value into a Layer-like type (either Layer itself or a monad transformer stack with Layer at the bottom).

nestWith ∷ ([a] → a) → Layer a () → Layer a () Source #

Collapse the given Layer into a single element by converting it into a list, applying the given function to the result and embedding it back.

newtype TestNestedM r Source #

Constructors

TestNestedM 

Fields

Instances

Instances details
Applicative TestNestedM Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

pure ∷ a → TestNestedM a Source #

(<*>)TestNestedM (a → b) → TestNestedM a → TestNestedM b Source #

liftA2 ∷ (a → b → c) → TestNestedM a → TestNestedM b → TestNestedM c Source #

(*>)TestNestedM a → TestNestedM b → TestNestedM b Source #

(<*)TestNestedM a → TestNestedM b → TestNestedM a Source #

Functor TestNestedM Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

fmap ∷ (a → b) → TestNestedM a → TestNestedM b Source #

(<$) ∷ a → TestNestedM b → TestNestedM a Source #

Monad TestNestedM Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

(>>=)TestNestedM a → (a → TestNestedM b) → TestNestedM b Source #

(>>)TestNestedM a → TestNestedM b → TestNestedM b Source #

return ∷ a → TestNestedM a Source #

unit ~ () ⇒ Monoid (TestNestedM unit) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

memptyTestNestedM unit Source #

mappendTestNestedM unit → TestNestedM unit → TestNestedM unit Source #

mconcat ∷ [TestNestedM unit] → TestNestedM unit Source #

unit ~ () ⇒ Semigroup (TestNestedM unit) Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

(<>)TestNestedM unit → TestNestedM unit → TestNestedM unit Source #

sconcatNonEmpty (TestNestedM unit) → TestNestedM unit Source #

stimesIntegral b ⇒ b → TestNestedM unit → TestNestedM unit Source #

MonadFree ((,) TestTree) TestNestedM Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

wrap ∷ (TestTree, TestNestedM a) → TestNestedM a

MonadReader [FilePath] TestNestedM Source # 
Instance details

Defined in Test.Tasty.Extras

Methods

askTestNestedM [FilePath]

local ∷ ([FilePath] → [FilePath]) → TestNestedM a → TestNestedM a

reader ∷ ([FilePath] → a) → TestNestedM a

type TestNested = TestNestedM () Source #

A TestTree of tests under some name prefix.

runTestNestedM ∷ [String] → TestNested → TestTree Source #

Run a TestNested computation to produce a TestTree (without actually executing the tests).

testNestedNamedM Source #

Arguments

FilePath

The name of the folder.

String

The name of the test group to render in CLI.

TestNested 
TestNested 

Descend into a folder.

testNestedMFilePathTestNestedTestNested Source #

Descend into a folder for a TestNested computation.

testNestedGhcMTestNestedTestNested Source #

Like testNestedM but adds a subdirectory corresponding to the GHC version being used.

runTestNested ∷ [String] → [TestNested] → TestTree Source #

Run a list of TestNested computation to produce a TestTree (without actually executing the tests).

testNestedNamed Source #

Arguments

FilePath

The name of the folder.

String

The name of the test group to render in CLI.

→ [TestNested] 
TestNested 

Descend into a folder for a list of tests.

testNestedFilePath → [TestNested] → TestNested Source #

Descend into a folder for a list of TestNested computations.

testNestedGhc ∷ [TestNested] → TestNested Source #

Like testNested but adds a subdirectory corresponding to the GHC version being used.

goldenVsText ∷ TestName → FilePath → Text → TestTree Source #

Check the contents of a file against a Text.

goldenVsTextM ∷ TestName → FilePathIO Text → TestTree Source #

Check the contents of a file against a Text.

goldenVsDoc ∷ TestName → FilePathDoc ann → TestTree Source #

Check the contents of a file against a Doc.

goldenVsDocM ∷ TestName → FilePathIO (Doc ann) → TestTree Source #

Check the contents of a file against a Doc.

nestedGoldenVsText ∷ TestName → FilePath → Text → TestNested Source #

Check the contents of a file under a name prefix against a Text.

nestedGoldenVsTextM ∷ TestName → FilePathIO Text → TestNested Source #

Check the contents of a file under a name prefix against a Text.

nestedGoldenVsDoc ∷ TestName → FilePathDoc ann → TestNested Source #

Check the contents of a file under a name prefix against a Text.

nestedGoldenVsDocM ∷ TestName → FilePathIO (Doc ann) → TestNested Source #

Check the contents of a file under a name prefix against a Text.

makeVersionedFilePath ∷ [FilePath] → FilePathFilePath Source #

Given a lists of FilePaths and a filename, concatenate the members of the list together, append the GHC version number, then append the filename. We use this to create GHC-version-dependent golden files.