| Copyright | © 2017-2024 Albert Krewinkel |
|---|---|
| License | MIT |
| Maintainer | Albert Krewinkel <tarleb@hslua.org> |
| Stability | beta |
| Portability | non-portable (depends on GHC) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Test.Tasty.HsLua
Description
Utilities for testing of HsLua operations.
Synopsis
- assertLuaBool :: HasCallStack => LuaE e Bool -> Assertion
- pushLuaExpr :: LuaError e => ByteString -> LuaE e ()
- shouldBeErrorMessageOf :: (HasCallStack, Show a) => String -> Lua a -> Assertion
- shouldBeResultOf :: (HasCallStack, Eq a, Show a) => a -> Lua a -> Assertion
- shouldHoldForResultOf :: (HasCallStack, Show a) => (a -> Bool) -> Lua a -> Assertion
- (=:) :: String -> Assertion -> TestTree
- (?:) :: HasCallStack => String -> LuaE e Bool -> TestTree
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 #
shouldHoldForResultOf :: (HasCallStack, Show a) => (a -> Bool) -> Lua a -> Assertion Source #
Checks whether the return value of an operation holds for the given predicate.