oughta-0.1.0.0: A library to test programs that output text.
Safe HaskellNone
LanguageGHC2021

Oughta

Description

See the package README for a high-level description.

Synopsis

Running checks

newtype Output Source #

Output of the program under test

Constructors

Output ByteString 

check :: LuaProgram -> Output -> IO Result Source #

Check some program output against a Oughta Lua program.

check' :: HasCallStack => LuaProgram -> Output -> IO () Source #

Like check, but throws an exception on failure.

Loading Lua programs

data LuaProgram Source #

Lua program paired with a SourceMap

addPrefix :: Text -> LuaProgram -> LuaProgram Source #

Add a prefix (i.e., prelude).

Bumps all subsequent line numbers

plainLuaProgram :: FilePath -> Text -> LuaProgram Source #

A standalone Lua program

fromLines :: FilePath -> (Text -> Maybe Text) -> Text -> LuaProgram Source #

Extract a Lua program embedded in certain lines of another file

fromLineComments Source #

Arguments

:: FilePath 
-> Text

Start of comment marker, e.g., "# "

-> Text

Whole file

-> LuaProgram 

Extract a Lua program embedded in the line comments of another file

Interpreting results

data Failure Source #

Failure to match a program against some text.

Constructors

Failure 

Fields

Instances

Instances details
Exception Failure Source # 
Instance details

Defined in Oughta.Result

Show Failure Source # 
Instance details

Defined in Oughta.Result

data Progress Source #

A sequence of successful matches of API calls against some text

Constructors

Progress 

Fields

data Success Source #

The result of matching a program against some text.

Constructors

Success 

Fields

newtype Result Source #

The result of running a Oughta Lua program

Constructors

Result (Either Failure Success) 

resultNull :: Result -> Bool Source #

Does this Rusult reflect running zero checks?

printResult :: Result -> Text Source #

Display a Result in human-readable Text

Source locations

data Loc Source #

A source location

Constructors

Loc 

Fields

data Pos Source #

A source position

Constructors

Pos 

Fields

data Span Source #

A source span

Constructors

Span 

Fields