hslua 1.3.0 → 1.3.0.1
raw patch · 9 files changed
+35/−18 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +10/−0
- README.md +4/−3
- hslua.cabal +1/−1
- prelude/Prelude.hs +0/−1
- src/Foreign/Lua/Core/Auxiliary.hs +2/−2
- src/Foreign/Lua/Core/Error.hs +6/−5
- test/Foreign/Lua/CoreTests.hs +9/−5
- test/Foreign/Lua/TypesTests.hs +2/−0
- test/test-hslua.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,15 @@ ## Changelog +### 1.3.0.1++Released 2021-02-06.++- Fixed build with GHC 9.0.1 (Simon Jakobi).++- Improved test-suite; fixed memory leaks in some tests.++- Moved CI to GitHub Actions.+ ### 1.3.0 Released 2020-10-16.
README.md view
@@ -1,14 +1,15 @@ # HsLua – Bindings to Lua, an embeddable scripting language -[![Build Status]](https://travis-ci.com/hslua/hslua)+[![Build status][GitHub Actions badge]][GitHub Actions] [![AppVeyor Status]](https://ci.appveyor.com/project/tarleb/hslua-r2y18) [![Hackage]](https://hackage.haskell.org/package/hslua) HsLua provides bindings, wrappers, types, and helper functions to bridge Haskell and Lua. -[Build Status]: https://travis-ci.com/hslua/hslua.svg?branch=master-[AppVeyor Status]: https://ci.appveyor.com/api/projects/status/ldutrilgxhpcau94/branch/master?svg=true+[GitHub Actions badge]: https://img.shields.io/github/workflow/status/hslua/hslua/CI.svg?logo=github+[GitHub Actions]: https://github.com/hslua/hslua/actions+[AppVeyor Status]: https://ci.appveyor.com/api/projects/status/ldutrilgxhpcau94/branch/main?svg=true [Hackage]: https://img.shields.io/hackage/v/hslua.svg
hslua.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hslua-version: 1.3.0+version: 1.3.0.1 synopsis: Bindings to Lua, an embeddable scripting language description: HsLua provides bindings, wrappers, types, and helper functions to bridge Haskell and <https://www.lua.org/ Lua>.
prelude/Prelude.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} module Prelude ( module Prelude.Compat , Semigroup (..)
src/Foreign/Lua/Core/Auxiliary.hs view
@@ -227,11 +227,11 @@ tostring' :: StackIndex -> Lua B.ByteString tostring' n = do l <- Lua.state- e2e <- Lua.errorToException <$> Lua.errorConversion+ e <- Lua.errorConversion Lua.liftIO $ alloca $ \lenPtr -> do cstr <- hsluaL_tolstring l n lenPtr if cstr == nullPtr- then e2e l+ then Lua.errorToException e l else do cstrLen <- Storable.peek lenPtr B.packCStringLen (cstr, fromIntegral cstrLen)
src/Foreign/Lua/Core/Error.hs view
@@ -77,9 +77,9 @@ -- expected to be at the top of the stack. throwErrorAsException :: Lua a throwErrorAsException = do- f <- Lua.errorToException <$> Lua.errorConversion+ e <- Lua.errorConversion l <- Lua.state- Lua.liftIO (f l)+ Lua.liftIO (Lua.errorToException e l) -- | Alias for `throwErrorAsException`; will be deprecated in the next -- mayor release.@@ -93,13 +93,14 @@ Lua.liftLua $ \l -> B.unsafeUseAsCStringLen (Utf8.fromString msg) $ \(msgPtr, z) -> lua_pushlstring l msgPtr (fromIntegral z)- Lua.errorConversion >>= Lua.liftLua . Lua.errorToException+ e <- Lua.errorConversion+ Lua.liftLua (Lua.errorToException e) instance Alternative Lua where empty = throwMessage "empty" x <|> y = do- alt <- Lua.alternative <$> Lua.errorConversion- x `alt` y+ e <- Lua.errorConversion+ Lua.alternative e x y -- | Convert the object at the top of the stack into a string and throw -- it as a HsLua @'Exception'@.
test/Foreign/Lua/CoreTests.hs view
@@ -76,7 +76,7 @@ ] , testGroup "insert"- [ "inserts stack elements using negative indices" ?: do+ [ "inserts stack elements using positive indices" ?: do pushLuaExpr "1, 2, 3, 4, 5, 6, 7, 8, 9" insert (-6) movedEl <- peek (-6) :: Lua Lua.Integer@@ -210,10 +210,14 @@ luaSt' <- peek stackTop return (luaSt == luaSt') - , "different threads are not equal in Haskell" ?: do- luaSt1 <- liftIO newstate- luaSt2 <- liftIO newstate- return (luaSt1 /= luaSt2)+ , "different threads are not equal in Haskell" ?:+ liftIO+ (do luaSt1 <- newstate+ luaSt2 <- newstate+ let result = luaSt1 /= luaSt2+ close luaSt1+ close luaSt2+ return result) , testGroup "thread status" [ "OK is base thread status" =:
test/Foreign/Lua/TypesTests.hs view
@@ -169,3 +169,5 @@ assert $ stackSize == newStackSize -- Check that we were able to peek at all pushed elements forM_ vals $ assert . (== t)+ -- Cleanup+ QCMonadic.run (close l)
test/test-hslua.hs view
@@ -44,7 +44,7 @@ , Foreign.Lua.PushTests.tests , Foreign.Lua.FunctionCallingTests.tests , Foreign.Lua.UtilTests.tests- , testGroup "Sendings and receiving values from the stack"+ , testGroup "Sending and receiving values from the stack" [ Foreign.Lua.TypesTests.tests , Foreign.Lua.Types.PeekableTests.tests , Foreign.Lua.Types.PushableTests.tests