hslua-module-version 1.0.0 → 1.0.1
raw patch · 7 files changed
+58/−29 lines, 7 filesdep +hslua-coredep −hsluadep ~hslua-marshallingdep ~hslua-packagingdep ~textPVP ok
version bump matches the API change (PVP)
Dependencies added: hslua-core
Dependencies removed: hslua
Dependency ranges changed: hslua-marshalling, hslua-packaging, text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +20/−3
- LICENSE +1/−1
- README.md +1/−1
- hslua-module-version.cabal +12/−10
- src/HsLua/Module/Version.hs +9/−8
- test/test-hslua-module-version.hs +9/−6
- test/test-version.lua +6/−0
CHANGELOG.md view
@@ -1,7 +1,24 @@ # Changelog -`hslua-module-version` uses [PVP Versioning](https://pvp.haskell.org).+`hslua-module-version` uses [PVP Versioning][]. -## 0.0.1+## hslua-module-version-1.0.1 -Release pending+- Relaxed upper bound of hslua-core, hslua-marshalling, and+ hslua-packaging, allowing their respective version 2.1.++- Version objects are now modifiable; setting a list index+ modifies the Version object:++ ``` lua+ local v = Version '5.3.6'+ v[2] = 2+ v[3] = nil+ assert(v == Version '5.2')+ ```++## hslua-module-version-1.0.0++Released 2021-10-22.++ [PVP Versioning]: https://pvp.haskell.org
LICENSE view
@@ -1,7 +1,7 @@ Copyright © 1994-2020 Lua.org, PUC-Rio. Copyright © 2007-2012 Gracjan Polak Copyright © 2012-2015 Ömer Sinan Ağacan-Copyright © 2016-2021 Albert Krewinkel+Copyright © 2016-2022 Albert Krewinkel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
README.md view
@@ -6,7 +6,7 @@ [![Stackage Nightly][Stackage Nightly badge]](http://stackage.org/nightly/package/hslua-module-version) [![MIT license][License badge]](LICENSE) -[CI badge]: https://github.com/hslua/hslua-module-version/workflows/CI/badge.svg+[CI badge]: https://img.shields.io/github/workflow/status/hslua/hslua/CI.svg?logo=github [Hackage badge]: https://img.shields.io/hackage/v/hslua-module-version.svg?logo=haskell [Stackage Lts badge]: http://stackage.org/package/hslua-module-version/badge/lts [Stackage Nightly badge]: http://stackage.org/package/hslua-module-version/badge/nightly
hslua-module-version.cabal view
@@ -1,15 +1,15 @@ cabal-version: 2.2 name: hslua-module-version-version: 1.0.0+version: 1.0.1 synopsis: Lua module to work with version specifiers. description: Wrapper for the Data.Version.Version Haskell type.-homepage: https://github.com/hslua/hslua-module-version-bug-reports: https://github.com/hslua/hslua-module-version/issues+homepage: https://hslua.org/+bug-reports: https://github.com/hslua/hslua/issues license: MIT license-file: LICENSE author: Albert Krewinkel maintainer: Albert Krewinkel <albert@zeitkraut.de>-copyright: © 2019-2021 Albert Krewinkel+copyright: © 2019-2022 Albert Krewinkel category: Foreign build-type: Simple extra-doc-files: README.md@@ -20,20 +20,22 @@ , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4- , GHC == 8.10.4+ , GHC == 8.10.7 , GHC == 9.0.1+ , GHC == 9.2.1 source-repository head type: git- location: https://github.com/hslua/hslua-module-version.git+ location: https://github.com/hslua/hslua.git+ subdir: hslua-module-version common common-options build-depends: base >= 4.9.1 && < 5 , filepath >= 1.4 && < 1.5- , hslua >= 2.0 && < 2.1- , hslua-marshalling >= 2.0 && < 2.1- , hslua-packaging >= 2.0 && < 2.1- , text >= 1.0 && < 1.3+ , hslua-core >= 2.0 && < 2.2+ , hslua-marshalling >= 2.0 && < 2.2+ , hslua-packaging >= 2.1 && < 2.2+ , text >= 1.2 && < 2.1 ghc-options: -Wall -Wcompat
src/HsLua/Module/Version.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {-| Module : HsLua.Module.Version-Copyright : © 2019-2021 Albert Krewinkel+Copyright : © 2019-2022 Albert Krewinkel License : MIT Maintainer : Albert Krewinkel <albert+hslua@zeitkraut.de> @@ -33,7 +33,7 @@ ( LuaError, Type (..) , call, dostring, error, ltype ) import HsLua.Marshalling ( Peeker, Pusher, failPeek, liftLua, peekIntegral, peekList, peekString- , pushBool, pushIntegral, pushIterator, pushString, retrieving )+ , pushIntegral, pushIterator, pushString, retrieving ) import HsLua.Packaging import Text.ParserCombinators.ReadP (readP_to_S) @@ -51,7 +51,7 @@ ### liftPure2 (\_ v -> v) <#> parameter (const $ pure ()) "table" "module table" "ignored" <#> versionParam "version" "version-like object"- =#> functionResult (pushUD typeVersion) "Version" "new Version object"+ =#> udresult typeVersion "new Version object" ] } @@ -64,7 +64,7 @@ , operation Len $ lambda ### liftPure (length . versionBranch) <#> versionParam "version" ""- =#> functionResult pushIntegral "integer" "number of version components"+ =#> integralResult "number of version components" , operation Pairs $ lambda ### pushIterator (\(i, n) -> 2 <$ pushIntegral i <* pushIntegral n) . zip [(1 :: Int) ..] . versionBranch@@ -73,16 +73,17 @@ , operation Tostring $ lambda ### liftPure showVersion <#> versionParam "version" ""- =#> functionResult pushString "string" "stringified version"+ =#> stringResult "stringified version" ] [ method must_be_at_least ]- (Just (versionBranch, pushIntegral))+ (Just ( (pushIntegral, versionBranch)+ , (peekIntegral, const makeVersion))) where versionComparison f descr = lambda ### liftPure2 f <#> versionParam "v1" "" <#> versionParam "v2" ""- =#> functionResult pushBool "boolean" descr+ =#> boolResult descr -- | Push a @'Version'@ element to the Lua stack. pushVersion :: LuaError e => Pusher e Version@@ -149,7 +150,7 @@ error) <#> versionParam "self" "version to check" <#> versionParam "reference" "minimum version"- <#> optionalParameter peekString "string" "msg" "alternative message"+ <#> opt (stringParam "msg" "alternative message") =?> mconcat [ "Returns no result, and throws an error if this " , "version is older than `reference`." ]
test/test-hslua-module-version.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE TypeApplications #-} {-| Module : Main-Copyright : © 2021 Albert Krewinkel+Copyright : © 2021-2022 Albert Krewinkel License : MIT Maintainer : Albert Krewinkel <albert+hslua@zeitkraut.de> @@ -11,20 +11,21 @@ module Main (main) where import Control.Monad (void)-import HsLua (Lua)-import HsLua.Packaging.Module (preloadModule, preloadModuleWithName, pushModule)+import HsLua.Core (Lua, top)+import HsLua.Packaging.Module+ (preloadModule, preloadModuleWithName, pushModule, registerModule) import HsLua.Module.Version (documentedModule) import Test.Tasty (TestTree, defaultMain, testGroup) import Test.Tasty.HUnit (assertEqual, testCase) import Test.Tasty.Lua (translateResultsFromFile) -import qualified HsLua as Lua+import qualified HsLua.Core as Lua main :: IO () main = do luaTestResults <- Lua.run @Lua.Exception $ do Lua.openlibs- Lua.registerModule documentedModule+ registerModule documentedModule Lua.pop 1 translateResultsFromFile "test/test-version.lua" defaultMain $ testGroup "hslua-module-version" [tests, luaTestResults]@@ -39,7 +40,9 @@ Lua.openlibs preloadModule documentedModule assertEqual' "function not added to preloader" Lua.TypeFunction =<< do- Lua.getglobal' "package.preload.Version"+ void $ Lua.getglobal "package"+ *> Lua.getfield top "preload"+ *> Lua.getfield top "Version" Lua.ltype (-1) , testCase "version module can be loaded as hsversion" . Lua.run $ do
test/test-version.lua view
@@ -105,6 +105,12 @@ assert.are_equal(#(Version '1.6'), 2) assert.are_equal(#(Version '8.7.5'), 3) assert.are_equal(#(Version '2.9.1.5'), 4)+ end),+ test('branches can be modified', function ()+ local v = Version '5.3.6'+ v[2] = 2+ v[3] = nil+ assert.are_equal(v, Version '5.2') end) } }