ouroboros-consensus-0.18.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Util.Serialisation.Golden

Description

Golden tests infrastructure.

Golden tests are implemented using tasty-golden.

When adding a new golden test, running the test suite locally will generate the golden files. These files should be checked in as CI will fail if there are missing golden files.

Failing a golden test suite when the corresponding golden files are not found is done via the --no-create flag, which surprisingly is opt-in. In our nix infrastructure, this flag for CI is set in nix/haskell.nix.

testFlags = lib.mkForce [ "--no-create" ];

In particular, if we introduce golden tests in new suites, we need to add a line in the nix configuration above similar to the previous ones.

Synopsis

Documentation

class ToGoldenDirectory a where Source #

Convert a to a FilePath that can be used as the directory containing golden output files.

This class allows overriding the Show in cases where that output is not suitable to be used as a directory.

For example, the Show output for a hard fork enabled NodeToNodeVersion will contain colons, asterisks, spaces, parentheses, ... and other characters that we don't want to use for a directory name. For instance colons cannot be used in Windows file/folder names.

Minimal complete definition

Nothing

Methods

toGoldenDirectory ∷ a → FilePath Source #

default toGoldenDirectoryShow a ⇒ a → FilePath Source #

goldenTest_all Source #

Golden tests for all things we serialise to disk and send across the network.

Exceptions: when an encoder throws an exception, which can happen when serialising a Shelley header in combination with CardanoNodeToNodeVersion1, we show the exception and use that as the output.

Orphan instances

Condense TermToken Source # 
Instance details