Copyright | (c) Sven Heyll 2016 |
---|---|
License | BSD-3 |
Maintainer | [email protected] |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Test.TypeSpec
Description
A tiny EDSL to write type-level-unit tests.
A simple example:
specHelloWorld :: Expect (Int `Isn't` Bool) specHelloWorld = Valid
We can also expect a bit more using lists and tuples:
specGrouped :: Expect '[ Int `Isn't` Bool , Int `Is` Int , Bool `Is` Bool `ButNot` String ] specGrouped = Valid
The expectations are executed by the compiler when solving the constraints of
TypeSpec
s constructors.
A TypeSpec
also has a Show
instance, which can be used in real unit tests
to print the expectations.
This module contains mainly re-exports of.
Synopsis
- type Expect = TypeSpec :: k -> Type
- type Explain (does :: Symbol) (this :: expectation) = TypeSpec (It does this)
- type Is = ShouldBe :: actual -> expected -> Type
- type IsTheSameAs = ShouldBe :: actual -> expected -> Type
- type TheseAreEqual = ShouldBe :: actual -> expected -> Type
- type IsNot = ShouldNotBe :: actual -> expected -> Type
- type Isn't = ShouldNotBe :: actual -> expected -> Type
- type IsNotTheSameAs = ShouldNotBe :: actual -> expected -> Type
- type IsDifferentFrom = ShouldNotBe :: actual -> expected -> Type
- type TheseAreNotEqual = ShouldNotBe :: actual -> expected -> Type
- type IsTrue = ShouldBeTrue :: expectation -> Type
- type And = ShouldBeTrue :: expectation -> Type
- type Therefore = ShouldBeTrue :: expectation -> Type
- type That = ShouldBeTrue :: expectation -> Type
- type IsFalse = ShouldBeFalse :: expectation -> Type
- type Not = ShouldBeTrue :: expectation -> Type
- type They (message :: Symbol) (expectations :: expectation) = It message expectations
- type Describe = It :: Symbol -> expectation -> Type
- type Context = It :: Symbol -> expectation -> Type
- type It's = It :: Symbol -> expectation -> Type
- module Test.TypeSpec.Core
- module Test.TypeSpec.Group
- module Test.TypeSpec.Label
- module Test.TypeSpec.ShouldBe
TypeSpec
Aliases
ShouldBe
aliases
type IsTheSameAs = ShouldBe :: actual -> expected -> Type Source #
type TheseAreEqual = ShouldBe :: actual -> expected -> Type Source #
ShouldNotBe
aliases
type IsNot = ShouldNotBe :: actual -> expected -> Type Source #
type Isn't = ShouldNotBe :: actual -> expected -> Type Source #
type IsNotTheSameAs = ShouldNotBe :: actual -> expected -> Type Source #
type IsDifferentFrom = ShouldNotBe :: actual -> expected -> Type Source #
type TheseAreNotEqual = ShouldNotBe :: actual -> expected -> Type Source #
ShouldBeTrue
aliases
type IsTrue = ShouldBeTrue :: expectation -> Type Source #
type And = ShouldBeTrue :: expectation -> Type Source #
type Therefore = ShouldBeTrue :: expectation -> Type Source #
type That = ShouldBeTrue :: expectation -> Type Source #
ShouldBeFalse
aliases
type IsFalse = ShouldBeFalse :: expectation -> Type Source #
type Not = ShouldBeTrue :: expectation -> Type Source #
Labelling Aliases
Reexports
module Test.TypeSpec.Core
module Test.TypeSpec.Group
module Test.TypeSpec.Label
module Test.TypeSpec.ShouldBe