type-spec-0.4.0.0: Type Level Specification by Example

Safe HaskellNone
LanguageHaskell2010

Test.TypeSpec.ShouldBe

Description

Type level assertions on type equality.

Synopsis

Documentation

data ShouldBe :: actual -> expected -> Type Source #

State that two types or type constructs are boiled down to the same type.

Instances
PrettyTypeSpec (ShouldBe a b :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

Methods

prettyTypeSpec :: proxy (ShouldBe a b) -> Doc Source #

type EvalExpectation (ShouldBe actual expected :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ShouldBe actual expected :: Type) = If (EqExtra actual expected) (OK (ShouldBe actual expected)) (FAILED ((Text "Expected type: " :<>: ShowType expected) :$$: (Text "Actual type: " :<>: ShowType actual)))
type EvalExpectation (ButNot (ShouldBe actual expected) other :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ButNot (ShouldBe actual expected) other :: Type) = If (EqExtra actual expected) (If (EqExtra other expected) (FAILED (((Text "Expected type: " :$$: (Text " " :<>: ShowType expected)) :$$: Text "to be different from: ") :$$: (Text " " :<>: ShowType other))) (OK (ButNot (ShouldBe actual expected) other))) (FAILED ((Text "Expected type: " :<>: ShowType expected) :$$: (Text "Actual type: " :<>: ShowType actual)))

data ShouldNotBe :: actual -> expected -> Type Source #

State that two types or type constructs are NOT the same type.

Instances
PrettyTypeSpec (ShouldNotBe a b :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

Methods

prettyTypeSpec :: proxy (ShouldNotBe a b) -> Doc Source #

type EvalExpectation (ShouldNotBe actual2 expected2 :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ShouldNotBe actual2 expected2 :: Type) = If (EqExtra expected2 actual2) (FAILED (((Text "Expected type: " :$$: (Text " " :<>: ShowType expected2)) :$$: Text "to be different from: ") :$$: (Text " " :<>: ShowType actual2))) (OK (ShouldNotBe actual2 expected2))

data ShouldBeTrue :: expectation -> Type Source #

State that a type is equal to the type level True.

Instances
PrettyTypeSpec (ShouldBeTrue a :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

Methods

prettyTypeSpec :: proxy (ShouldBeTrue a) -> Doc Source #

type EvalExpectation (ShouldBeTrue t2 :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ShouldBeTrue t2 :: Type) = If (EqExtra t2 True) (OK (ShouldBeTrue t2)) (FAILED (Text "Should have been 'True: " :<>: ShowType t2))

data ShouldBeFalse :: expectation -> Type Source #

State that a type is equal to the type level False.

Instances
PrettyTypeSpec (ShouldBeFalse a :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

Methods

prettyTypeSpec :: proxy (ShouldBeFalse a) -> Doc Source #

type EvalExpectation (ShouldBeFalse t2 :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ShouldBeFalse t2 :: Type) = If (EqExtra t2 False) (OK (ShouldBeFalse t2)) (FAILED (Text "Should have been 'False: " :<>: ShowType t2))

data ButNot :: shouldBe -> shouldntBe -> Type Source #

State that one type is different to two other types. This must always be used right next to a ShouldBe pair, otherwise this will not work.

Instances
a ~ ShouldBe a0 a1 => PrettyTypeSpec (ButNot a b :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

Methods

prettyTypeSpec :: proxy (ButNot a b) -> Doc Source #

type EvalExpectation (ButNot (ShouldBe actual expected) other :: Type) Source # 
Instance details

Defined in Test.TypeSpec.ShouldBe

type EvalExpectation (ButNot (ShouldBe actual expected) other :: Type) = If (EqExtra actual expected) (If (EqExtra other expected) (FAILED (((Text "Expected type: " :$$: (Text " " :<>: ShowType expected)) :$$: Text "to be different from: ") :$$: (Text " " :<>: ShowType other))) (OK (ButNot (ShouldBe actual expected) other))) (FAILED ((Text "Expected type: " :<>: ShowType expected) :$$: (Text "Actual type: " :<>: ShowType actual)))