ganeti
Safe HaskellNone

Test.Ganeti.THH

Contents

Description

Unittests for our template-haskell generated code.

Synopsis

Custom types

data TestObj Source #

Type used to test optional field implementation. Equivalent to data TestObj = TestObj { tobjA :: Maybe Int, tobjB :: Maybe Int }.

Constructors

TestObj 

Fields

loadTestObj :: JSValue -> Result TestObj Source #

saveTestObj :: TestObj -> JSValue Source #

prop_OptFields :: TestObj -> Property Source #

Tests that serialising an (arbitrary) TestObj instance is correct: fully optional fields are represented in the resulting dictionary only when non-null, optional-but-required fields are always represented (with either null or an actual value).

prop_TestObj_serialization :: TestObj -> Property Source #

Test serialization of TestObj.

prop_TestObj_deserialisationFail :: Property Source #

Test that all superfluous keys will fail to parse.

data UnitObj Source #

A unit-like data type.

Constructors

UnitObj 

loadUnitObj :: JSValue -> Result UnitObj Source #

saveUnitObj :: UnitObj -> JSValue Source #

prop_UnitObj_serialization :: UnitObj -> Property Source #

Test serialization of UnitObj.

prop_UnitObj_deserialisationFail :: Property Source #

Test that all superfluous keys will fail to parse.

data FilledTestParams Source #

Constructors

FilledTestParams 

Fields

data PartialTestParams Source #

Constructors

PartialTestParams 

Fields

prop_fillWithPartialParams :: Property Source #

Tests that filling partial parameters works as expected.

prop_fillPartialLaw1 :: FilledTestParams -> PartialTestParams -> Property Source #

Tests that filling partial parameters satisfies the law.

prop_toParams :: Property Source #

Tests that filling partial parameters works as expected.

prop_fillPartialLaw2 :: FilledTestParams -> FilledTestParams -> Property Source #

Tests that filling partial parameters satisfies the law.

prop_fillPartialLaw3 :: FilledTestParams -> Property Source #

Tests that filling partial parameters satisfies the law.

prop_fillPartialMonoidLaw1 :: FilledTestParams -> Property Source #

Tests that the monoid action laws are satisfied.

prop_fillPartialMonoidLaw2 :: FilledTestParams -> PartialTestParams -> PartialTestParams -> Property Source #

Tests that the monoid action laws are satisfied.

testTHH :: Test Source #