packages feed

hslua-core 2.2.1 → 2.3.0

raw patch · 27 files changed

+201/−77 lines, 27 filesdep ~basedep ~luaPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, lua

API changes (from Hackage documentation)

+ HsLua.Core: closeGCManagedState :: GCManagedState -> IO ()
+ HsLua.Core: data GCManagedState
+ HsLua.Core: newGCManagedState :: IO GCManagedState
+ HsLua.Core: setwarnf :: WarnFunction -> Ptr () -> LuaE e ()
+ HsLua.Core: setwarnf' :: LuaError e => (ByteString -> LuaE e ()) -> LuaE e ()
+ HsLua.Core: withGCManagedState :: GCManagedState -> LuaE e a -> IO a
+ HsLua.Core.Types: instance GHC.Read.Read HsLua.Core.Types.Type
- HsLua.Core: dofile :: FilePath -> LuaE e Status
+ HsLua.Core: dofile :: Maybe FilePath -> LuaE e Status
- HsLua.Core: dofileTrace :: FilePath -> LuaE e Status
+ HsLua.Core: dofileTrace :: Maybe FilePath -> LuaE e Status
- HsLua.Core: loadfile :: FilePath -> LuaE e Status
+ HsLua.Core: loadfile :: Maybe FilePath -> LuaE e Status
- HsLua.Core.Trace: dofileTrace :: FilePath -> LuaE e Status
+ HsLua.Core.Trace: dofileTrace :: Maybe FilePath -> LuaE e Status

Files

CHANGELOG.md view
@@ -2,6 +2,27 @@  `hslua-core` uses [PVP Versioning][]. +## hslua-core-2.3.0++Released 2023-03-13.++-   The functions `loadfile`, `dofile`, and `dofileTrace` now+    expect the argument to be of type `Maybe FilePath`. The+    functions load from *stdin* when the argument is `Nothing`.++-   Added `setwarnf'` for simple warning messgae handling: The+    built-in method of setting a warn function is flexible but not+    straight-forward to use. The new `setwarnf'` function allows+    to set a Haskell action as a warning hook: the default warning+    behavior is kept in place, but, in addition to the default+    action, the hook is called on the concatenated warning+    messages. This can be used to plug Lua warnings into an+    application specific Haskell reporting system.++-   Export `GCManagedState`, `newGCManagedState`,+    `closeGCManagedState`, and `withGCManagedState` from+    `HsLua.Core`.+ ## hslua-core-2.2.1  Released 2022-06-19.
LICENSE view
@@ -1,7 +1,7 @@ Copyright © 1994-2022 Lua.org, PUC-Rio. Copyright © 2007-2012 Gracjan Polak Copyright © 2012-2015 Ömer Sinan Ağacan-Copyright © 2016-2022 Albert Krewinkel+Copyright © 2016-2023 Albert Krewinkel  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
hslua-core.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                hslua-core-version:             2.2.1+version:             2.3.0 synopsis:            Bindings to Lua, an embeddable scripting language description:         Wrappers and helpers to bridge Haskell and                      <https://www.lua.org/ Lua>.@@ -12,23 +12,22 @@ license:             MIT license-file:        LICENSE author:              Albert Krewinkel, Gracjan Polak, Ömer Sinan Ağacan-maintainer:          albert+hslua@zeitkraut.de+maintainer:          tarleb@hslua.org copyright:           © 2007–2012 Gracjan Polak;                      © 2012–2016 Ömer Sinan Ağacan;-                     © 2017-2022 Albert Krewinkel+                     © 2017-2023 Albert Krewinkel category:            Foreign build-type:          Simple extra-source-files:  README.md                    , CHANGELOG.md                    , test/lua/*.lua-tested-with:         GHC == 8.0.2-                   , GHC == 8.2.2-                   , GHC == 8.4.4+tested-with:         GHC == 8.4.4                    , GHC == 8.6.5                    , GHC == 8.8.4                    , GHC == 8.10.7                    , GHC == 9.0.2-                   , GHC == 9.2.3+                   , GHC == 9.2.5+                   , GHC == 9.4.4  source-repository head   type:                git@@ -36,10 +35,10 @@  common common-options   default-language:    Haskell2010-  build-depends:       base          >= 4.8    && < 5+  build-depends:       base          >= 4.11   && < 5                      , bytestring    >= 0.10.2 && < 0.12                      , exceptions    >= 0.8    && < 0.11-                     , lua           >= 2.2.1  && < 2.3+                     , lua           >= 2.3    && < 2.4                      , mtl           >= 2.2    && < 2.4                      , text          >= 1.2    && < 2.1   ghc-options:         -Wall@@ -69,6 +68,7 @@                      , HsLua.Core.Utf8   other-modules:       HsLua.Core.Auxiliary                      , HsLua.Core.Primary+                     , HsLua.Core.Warn   reexported-modules:  lua:Lua   hs-source-dirs:      src   default-extensions:  LambdaCase@@ -96,6 +96,7 @@                      , HsLua.Core.TraceTests                      , HsLua.Core.UnsafeTests                      , HsLua.Core.UserdataTests+                     , HsLua.Core.WarnTests                      , Test.Tasty.HsLua                      , Test.HsLua.Arbitrary   build-depends:       hslua-core
src/HsLua/Core.hs view
@@ -2,9 +2,9 @@ Module      : HsLua.Core Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) @@ -19,6 +19,10 @@     run   , runWith   , runEither+  , GCManagedState+  , newGCManagedState+  , closeGCManagedState+  , withGCManagedState   -- * Lua Computations   , LuaE (..)   , Lua@@ -144,6 +148,7 @@   , concat   , pushglobaltable   , register+  , setwarnf   -- * loading libraries   , openbase   , opendebug@@ -183,6 +188,8 @@   , callTrace   , dofileTrace   , dostringTrace+  -- ** Warnings+  , setwarnf'   -- * Haskell userdata values   --   -- | Push arbitrary Haskell values to the Lua stack.@@ -221,3 +228,4 @@ import HsLua.Core.Trace import HsLua.Core.Types as Lua import HsLua.Core.Userdata+import HsLua.Core.Warn
src/HsLua/Core/Auxiliary.hs view
@@ -6,9 +6,9 @@ Module      : HsLua.Core.Auxiliary Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) @@ -87,8 +87,8 @@ -- | Loads and runs the given file. Note that the filepath is -- interpreted by Lua, not Haskell. The resulting chunk is named using -- the UTF8 encoded filepath.-dofile :: FilePath -> LuaE e Status-dofile fp = loadfile fp >>= \case+dofile :: Maybe FilePath -> LuaE e Status+dofile mfp = loadfile mfp >>= \case   Lua.OK -> Lua.pcall 0 multret Nothing   err    -> return err {-# INLINABLE dofile #-}@@ -161,8 +161,9 @@ {-# INLINABLE loadbuffer #-}  -- | Loads a file as a Lua chunk. This function uses @lua_load@ (see--- @'Lua.load'@) to load the chunk in the file named filename. The first--- line in the file is ignored if it starts with a @#@.+-- @'Lua.load'@) to load the chunk in the file named @filename@. If+-- filename is @Nothing@, then it loads from the standard input. The+-- first line in the file is ignored if it starts with a @#@. -- -- The string mode works as in function @'Lua.load'@. --@@ -174,15 +175,19 @@ -- it. -- -- See <https://www.lua.org/manual/5.4/manual.html#luaL_loadfile luaL_loadfile>.-loadfile :: FilePath -- ^ filename+loadfile :: Maybe FilePath -- ^ filename          -> LuaE e Status-loadfile fp = liftLua $ \l -> do+loadfile mfp = liftLua $ \l -> do #if defined(mingw32_HOST_OS)   fsEncoding <- GHC.mkTextEncoding "CP0"  -- a.k.a CP_ACP #else   fsEncoding <- GHC.getFileSystemEncoding #endif-  GHC.withCString fsEncoding fp $! fmap Lua.toStatus . luaL_loadfile l+  case mfp of+    Just fp ->+      GHC.withCString fsEncoding fp $! fmap Lua.toStatus . luaL_loadfile l+    Nothing ->+      Lua.toStatus <$!> luaL_loadfile l nullPtr {-# INLINABLE loadfile #-}  -- | Loads a string as a Lua chunk. This function uses @lua_load@ to
src/HsLua/Core/Closures.hs view
@@ -2,9 +2,9 @@ Module      : HsLua.Core.Closures Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) 
src/HsLua/Core/Error.hs view
@@ -8,9 +8,9 @@ {-# OPTIONS_GHC -Wno-warnings-deprecations #-} {-| Module      : HsLua.Core.Error-Copyright   : © 2017-2022 Albert Krewinkel+Copyright   : © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org>  Lua exceptions and exception handling. -}
src/HsLua/Core/Package.hs view
@@ -1,8 +1,8 @@ {-| Module      : HsLua.Core.Package-Copyright   : © 2019-2022 Albert Krewinkel+Copyright   : © 2019-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <albert+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : alpha Portability : Requires GHC 8 or later. 
src/HsLua/Core/Primary.hs view
@@ -3,9 +3,9 @@ Module      : HsLua.Core.Primary Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) @@ -887,6 +887,15 @@ setiuservalue :: StackIndex {- ^ index -} -> Int {- ^ n -} -> LuaE e Bool setiuservalue idx n = liftLua $ \l ->   fromLuaBool <$!> lua_setiuservalue l idx (fromIntegral n)++-- | Sets the warning function to be used by Lua to emit warnings (see+-- 'WarnFunction'). The @ud@ parameter sets the value @ud@ passed to the+-- warning function.+setwarnf :: WarnFunction -- ^ f+         -> Ptr ()       -- ^ ud+         -> LuaE e ()+setwarnf f ud = liftLua $ \l ->+  lua_setwarnf l f ud  -- |  Returns the status of this Lua thread. --
src/HsLua/Core/Run.hs view
@@ -2,9 +2,9 @@ Module      : HsLua.Core.Run Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) 
src/HsLua/Core/Trace.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE TypeApplications #-} {-| Module      : HsLua.Core.Trace-Copyright   : © 2017-2022 Albert Krewinkel+Copyright   : © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org>  Helper functions to call Lua functions with tracebacks. -}@@ -44,7 +44,7 @@  -- | Run the given file as a Lua program, while also adding a -- traceback to the error message if an error occurs.-dofileTrace :: FilePath -> LuaE e Status+dofileTrace :: Maybe FilePath -> LuaE e Status dofileTrace fp = loadfile fp >>= \case   OK -> pcallTrace 0 multret   s  -> pure s
src/HsLua/Core/Types.hs view
@@ -1,12 +1,11 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-| Module      : HsLua.Core.Types Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) @@ -81,9 +80,6 @@   , toReference   ) import qualified HsLua.Core.Utf8 as Utf8-#if !MIN_VERSION_base(4,12,0)-import Data.Semigroup (Semigroup)-#endif  -- | Environment in which Lua computations are evaluated. newtype LuaEnvironment = LuaEnvironment@@ -129,6 +125,9 @@ {-# INLINABLE runWith #-}  -- | Run the given operation, but crash if any Haskell exceptions occur.+--+-- This function is identical to 'runWith'; it exists for backwards+-- compatibility. unsafeRunWith :: State -> LuaE e a -> IO a unsafeRunWith = runWith @@ -153,7 +152,7 @@   | TypeFunction       -- ^ type of functions, either normal or @'CFunction'@   | TypeUserdata       -- ^ type of full user data   | TypeThread         -- ^ type of Lua threads-  deriving (Bounded, Eq, Ord, Show)+  deriving (Bounded, Eq, Ord, Show, Read)  instance Enum Type where   fromEnum = fromIntegral . fromTypeCode . fromType
src/HsLua/Core/Unsafe.hs view
@@ -1,9 +1,9 @@ {-# OPTIONS_GHC -Wno-warnings-deprecations #-} {-| Module      : HsLua.Core.Unsafe-Copyright   : © 2019-2022 Albert Krewinkel+Copyright   : © 2019-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <albert+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org>  Unsafe Lua functions. 
src/HsLua/Core/Userdata.hs view
@@ -3,9 +3,9 @@ Module      : HsLua.Core.Userdata Copyright   : © 2007–2012 Gracjan Polak;               © 2012–2016 Ömer Sinan Ağacan;-              © 2017-2022 Albert Krewinkel+              © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) @@ -29,7 +29,9 @@  -- | Creates a new userdata wrapping the given Haskell object. The -- userdata is pushed to the top of the stack.-newhsuserdatauv :: forall a e. a -> Int -> LuaE e ()+newhsuserdatauv :: forall a e. a -- ^ Haskell object+                -> Int           -- ^ number of extra userdata values+                -> LuaE e () newhsuserdatauv x nuvalue = liftLua $ \l ->   hslua_newhsuserdatauv l x (fromIntegral nuvalue) {-# INLINABLE newhsuserdatauv #-}@@ -37,6 +39,8 @@ -- | Creates and registers a new metatable for a userdata-wrapped -- Haskell value; checks whether a metatable of that name has been -- registered yet and uses the registered table if possible.+--+-- Returns 'True' if a new metatable was created, and 'False' otherwise. -- -- Using a metatable created by this functions ensures that the pointer -- to the Haskell value will be freed when the userdata object is
src/HsLua/Core/Utf8.hs view
@@ -1,8 +1,8 @@ {-| Module      : HsLua.Core.Utf8-Copyright   : © 2018-2022 Albert Krewinkel+Copyright   : © 2018-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : portable 
+ src/HsLua/Core/Warn.hs view
@@ -0,0 +1,42 @@+{-|+Module      : HsLua.Core.Warn+Copyright   : © 2023 Albert Krewinkel+License     : MIT+Maintainer  : Albert Krewinkel <tarleb@hslua.org>++Simpler interface to the Lua warnings system.++This module simplifies the process of setting a custom warn function.+-}+module HsLua.Core.Warn+  ( setwarnf'+  ) where++import Data.ByteString (ByteString)+import HsLua.Core.Closures (pushHaskellFunction)+import HsLua.Core.Error (LuaError)+import HsLua.Core.Primary (tostring)+import HsLua.Core.Types (LuaE, NumResults (..), liftLua, nthBottom)+import Lua.Warn (hsluaL_setwarnf)++-- | Sets a warning function. This is a simplified version of+-- 'lua_setwarnf'. The given function is called with the concatenated+-- warning components as the single argument.+--+-- Control messages are handled internally and are /not/ passed on the+-- warning hook. As with the default warning function, the control+-- messages @\@on@ and @\@off@ can switch error reporting to stderr on+-- and off. The given Haskell function will be called in either case,+-- even when the error is not written to stderr.+--+-- Wraps 'hsluaL_setwarnf'.+setwarnf' :: LuaError e+          => (ByteString -> LuaE e ())+          -> LuaE e ()+setwarnf' fn = do+  pushHaskellFunction $ do+    mbmsg <- tostring (nthBottom 1)+    case mbmsg of+      Nothing  -> pure (NumResults 0)  -- couldn't get warning msg; do nothing+      Just msg -> NumResults 0 <$ fn msg+  liftLua hsluaL_setwarnf
test/HsLua/Core/ClosuresTests.hs view
@@ -2,10 +2,10 @@ {-# OPTIONS_GHC -fno-warn-deprecations #-} {-| Module      :  HsLua.Core.ClosuresTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable 
test/HsLua/Core/PackageTests.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module      :  HsLua.Core.RunTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable 
test/HsLua/Core/RunTests.hs view
@@ -3,10 +3,10 @@ {-# OPTIONS_GHC -fno-warn-deprecations #-} {-| Module      :  HsLua.Core.RunTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable 
test/HsLua/Core/TraceTests.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module      :  HsLua.Core.TraceTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable 
test/HsLua/Core/UnsafeTests.hs view
@@ -2,9 +2,9 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module      : HsLua.Core.UnsafeTests-Copyright   : © 2021-2022 Albert Krewinkel+Copyright   : © 2021-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta  Tests for bindings to unsafe functions.
test/HsLua/Core/UserdataTests.hs view
@@ -1,10 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module      :  HsLua.Core.UserdataTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org>  Tests that any data type can be pushed to Lua. -}
+ test/HsLua/Core/WarnTests.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE OverloadedStrings #-}+{-|+Module      :  HsLua.Core.WarnTests+Copyright   :  © 2017-2023 Albert Krewinkel+License     :  MIT++Maintainer  :  Albert Krewinkel <tarleb@hslua.org>++Check that setting hook for warning messages works.+-}+module HsLua.Core.WarnTests (tests) where++import HsLua.Core+import Test.Tasty.HsLua ((=:), shouldBeResultOf)+import Test.Tasty (TestTree, testGroup)++-- | Specifications for Attributes parsing functions.+tests :: TestTree+tests = testGroup "Warn"+  [ "warnings get handled" =:+    Just "Hi Mom!" `shouldBeResultOf` do+      openlibs+      setwarnf' $ \msg -> do+        pushstring msg+        setfield registryindex "hslua testing"+      stat <- dostring "warn('Hi', ' ', 'Mom!')"+      case stat of+        OK -> do+          getfield registryindex "hslua testing"+          tostring top+        _  -> do+          throwErrorAsException+  ]
test/HsLua/CoreTests.hs view
@@ -3,10 +3,10 @@ {-# OPTIONS_GHC -fno-warn-deprecations #-} {-| Module      :  HsLua.CoreTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable @@ -41,6 +41,7 @@ import qualified HsLua.Core.TraceTests import qualified HsLua.Core.UnsafeTests import qualified HsLua.Core.UserdataTests+import qualified HsLua.Core.WarnTests import qualified Foreign.Marshal as Foreign import qualified Foreign.Ptr as Foreign import qualified Test.QuickCheck.Monadic as QCMonadic@@ -345,17 +346,17 @@      , testGroup "loadfile"       [ "file error should be returned when file does not exist" =:-        ErrFile `shouldBeResultOf` loadfile "./file-does-not-exist.lua"+        ErrFile `shouldBeResultOf` loadfile (Just "./file-does-not-exist.lua")        , "loading an invalid file should give a syntax error" =:-        ErrSyntax `shouldBeResultOf` loadfile "test/lua/syntax-error.lua"+        ErrSyntax `shouldBeResultOf` loadfile (Just "test/lua/syntax-error.lua")        , "loading a valid program should succeed" =:-        OK `shouldBeResultOf` loadfile "./test/lua/example.lua"+        OK `shouldBeResultOf` loadfile (Just "./test/lua/example.lua")        , "example fib program should be loaded correctly" =:         Just 8 `shouldBeResultOf` do-          loadfile "./test/lua/example.lua" *> call 0 0+          loadfile (Just "./test/lua/example.lua") *> call 0 0           getglobal "fib"           pushinteger 6           call 1 1@@ -364,20 +365,20 @@      , testGroup "dofile"       [ "file error should be returned when file does not exist" =:-        ErrFile `shouldBeResultOf` dofile "./file-does-not-exist.lua"+        ErrFile `shouldBeResultOf` dofile (Just "./file-does-not-exist.lua")        , "loading an invalid file should give a syntax error" =:-        ErrSyntax `shouldBeResultOf` dofile "test/lua/syntax-error.lua"+        ErrSyntax `shouldBeResultOf` dofile (Just "test/lua/syntax-error.lua")        , "loading a failing program should give an run error" =:-        ErrRun `shouldBeResultOf` dofile "test/lua/error.lua"+        ErrRun `shouldBeResultOf` dofile (Just "test/lua/error.lua")        , "loading a valid program should succeed" =:-        OK `shouldBeResultOf` dofile "./test/lua/example.lua"+        OK `shouldBeResultOf` dofile (Just "./test/lua/example.lua")        , "example fib program should be loaded correctly" =:         Just 21 `shouldBeResultOf` do-          _ <- dofile "./test/lua/example.lua"+          _ <- dofile (Just "./test/lua/example.lua")           getglobal "fib"           pushinteger 8           call 1 1@@ -454,6 +455,7 @@   , HsLua.Core.TraceTests.tests   , HsLua.Core.UnsafeTests.tests   , HsLua.Core.UserdataTests.tests+  , HsLua.Core.WarnTests.tests   ]  compareWith :: (Lua.Integer -> Lua.Integer -> Bool)
test/Test/HsLua/Arbitrary.hs view
@@ -2,10 +2,10 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module      :  HsLua.Core.RunTests-Copyright   :  © 2017-2022 Albert Krewinkel+Copyright   :  © 2017-2023 Albert Krewinkel License     :  MIT -Maintainer  :  Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  :  Albert Krewinkel <tarleb@hslua.org> Stability   :  stable Portability :  portable 
test/Test/Tasty/HsLua.hs view
@@ -1,9 +1,9 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module      : Test.Tasty.HsLua-Copyright   : © 2017-2022 Albert Krewinkel+Copyright   : © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org> Stability   : beta Portability : non-portable (depends on GHC) 
test/test-hslua-core.hs view
@@ -1,8 +1,8 @@ {-| Module      : Main-Copyright   : © 2017-2022 Albert Krewinkel+Copyright   : © 2017-2023 Albert Krewinkel License     : MIT-Maintainer  : Albert Krewinkel <tarleb+hslua@zeitkraut.de>+Maintainer  : Albert Krewinkel <tarleb@hslua.org>  Tests for HsLua.Core. -}