tasty-hslua-1.1.1: Tasty helpers to test HsLua.
Copyright© 2017-2024 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb@hslua.org>
Stabilitybeta
Portabilitynon-portable (depends on GHC)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Tasty.HsLua

Description

Utilities for testing of HsLua operations.

Synopsis

Documentation

assertLuaBool :: HasCallStack => LuaE e Bool -> Assertion Source #

Checks whether the operation returns True.

pushLuaExpr :: LuaError e => ByteString -> LuaE e () Source #

Takes a Lua expression as a ByteString, evaluates it and pushes the result to the stack.

-- will return "12"
run $ do
  pushLuaExpr "7 + 5"
  tointeger top

shouldBeErrorMessageOf :: (HasCallStack, Show a) => String -> Lua a -> Assertion Source #

Checks whether a Lua operation fails with the given string as error message.

shouldBeResultOf :: (HasCallStack, Eq a, Show a) => a -> Lua a -> Assertion Source #

Takes a value and a Lua operation and turns them into an Assertion which checks that the operation produces the given value.

shouldHoldForResultOf :: (HasCallStack, Show a) => (a -> Bool) -> Lua a -> Assertion Source #

Checks whether the return value of an operation holds for the given predicate.

(=:) :: String -> Assertion -> TestTree infix 3 Source #

Infix alias for testCase.

(?:) :: HasCallStack => String -> LuaE e Bool -> TestTree infixr 3 Source #

Infix alias for luaTestBool.