hspec-core-2.7.0: A Testing Framework for Haskell

Test.Hspec.Core.Util

Description

Synopsis

# String functions

pluralize count singular pluralizes the given singular word unless given count is 1.

Examples:

>>> pluralize 0 "example"
"0 examples"

>>> pluralize 1 "example"
"1 example"

>>> pluralize 2 "example"
"2 examples"


lineBreaksAt :: Int -> String -> [String] Source #

ensure that lines are not longer than given n, insert line breaks at word boundaries

# Working with paths

type Path = ([String], String) Source #

A Path describes the location of a spec item within a spec tree.

It consists of a list of group descriptions and a requirement description.

Join a Path with slashes. The result will have a leading and a trailing slash.

Try to create a proper English sentence from a path by applying some heuristics.

A predicate that can be used to filter a spec tree.

# Working with exception

safeTry evaluates given action and returns its result. If an exception occurs, the exception is returned instead. Unlike try it is agnostic to asynchronous exceptions.

The function formatException converts an exception to a string.

This is different from show. The type of the exception is included, e.g.:

>>> formatException (toException DivideByZero)
"ArithException (divide by zero)"


For IOExceptions the IOErrorType is included, as well.