fitspec-0.4.6: refining property sets for testing Haskell programs

Copyright(c) 2015-2017 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellSafe
LanguageHaskell2010

Test.FitSpec.PrettyPrint

Description

A very simple pretty printing library used to generate FitSpec reports.

Synopsis

Documentation

beside :: String -> String -> String Source #

Appends two Strings side by side, line by line

beside ["asdf\nqw\n","zxvc\nas"] ==
 "asdfzxvc\n\
 \qw  as\n"

above :: String -> String -> String Source #

Append two Strings on top of each other, adding line breaks *when needed*.

showTuple :: [String] -> String Source #

Show elements of a list as a tuple. If there are multiple lines in any of the strings, tuple is printed multiline.

showTuple ["asdf\nqwer\n","zxvc\nasdf\n"] ==
  "( asdf\n\
  \  qwer\n\
  \, zxvc\n\
  \  asdf )\n"
showTuple ["asdf","qwer"] == "(asdf,qwer)"

table :: String -> [[String]] -> String Source #

Formats a table using a given separator.

table "  " [ ["asdf", "qwer",     "zxvc\nzxvc"]
           , ["0",    "1",        "2"]
           , ["123",  "456\n789", "3"] ] ==
  "asdf  qwer  zxvc\n\
  \            zxvc\n\
  \0     1     2\n\
  \123   456   3\n\
  \      789\n\"

columns :: String -> [String] -> String Source #

Given a separator, format strings in columns

columns " | " ["asdf", "qw\nzxcv", "as\ndf"] ==
  "asdf | qw   | as\n\
  \     | zxcv | df\n"

showEach :: Show a => String -> [a] -> String Source #