packages feed

tasty-lua 1.0.2 → 1.1.0

raw patch · 8 files changed

+36/−34 lines, 8 filesdep ~basedep ~hslua-coredep ~hslua-marshalling

Dependency ranges changed: base, hslua-core, hslua-marshalling

Files

CHANGELOG.md view
@@ -2,6 +2,13 @@  `tasty-lua` uses [PVP Versioning][]. +## tasty-lua-1.1.0++Released 2023-03-13.++-   Fixed `peekOutcome`, allowing any result type. This gives much+    better results when working with custom error objects.+ ## tasty-lua-1.0.2  Released 2022-02-19.
src/Test/Tasty/Lua.hs view
@@ -1,12 +1,11 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-| Module      : Test.Tasty.Lua-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 TemplateHaskell @@ -35,10 +34,6 @@ import Test.Tasty.Lua.Core (Outcome (..), ResultTree (..), UnnamedTree (..),                             runTastyFile) import Test.Tasty.Lua.Translate (pathFailure, translateResultsFromFile)--#if !MIN_VERSION_base(4,12,0)-import Data.Semigroup (Semigroup ((<>)))-#endif  -- | Run the given file as a single test. It is possible to use -- `tasty.lua` in the script. This test collects and summarizes all
src/Test/Tasty/Lua/Arbitrary.hs view
@@ -3,9 +3,9 @@ {-# LANGUAGE TypeApplications    #-} {-| Module      : Test.Tasty.Lua.Arbitrary-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>  Generators for arbitrary Lua values. -}
src/Test/Tasty/Lua/Core.hs view
@@ -2,9 +2,9 @@ {-# LANGUAGE ScopedTypeVariables #-} {-| Module      : Test.Tasty.Lua.Core-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>  Core types and functions for tasty Lua tests. -}@@ -17,10 +17,10 @@ where  import Control.Monad ((<$!>), void)-import HsLua.Core (LuaE, LuaError, toboolean, top)+import HsLua.Core (LuaE, LuaError, pop, toboolean, top) import HsLua.Marshalling-  ( Peeker, failPeek, liftLua, resultToEither, retrieving-  , peekFieldRaw, peekList, peekString, runPeek, typeMismatchMessage)+  ( Peeker, lastly, liftLua, resultToEither, retrieving+  , peekFieldRaw, peekList, peekString, runPeek) import Test.Tasty.Lua.Module (pushModule) import qualified HsLua.Core as Lua import qualified HsLua.Core.Utf8 as Utf8@@ -32,7 +32,7 @@ runTastyFile fp = do   Lua.openlibs   Lua.requirehs "tasty" (const . void $ pushModule)-  res <- Lua.dofileTrace fp+  res <- Lua.dofileTrace (Just fp)   if res /= Lua.OK     then Left . Utf8.toString <$> Lua.tostring' top     else resultToEither <$> runPeek (peekList peekResultTree top)@@ -64,11 +64,12 @@ data Outcome = Success | Failure String  -- | Unmarshal a test outcome-peekOutcome :: Peeker e Outcome+peekOutcome :: LuaError e => Peeker e Outcome peekOutcome idx = retrieving "test result" $ do   liftLua (Lua.ltype idx) >>= \case     Lua.TypeString  -> Failure <$!> peekString idx     Lua.TypeBoolean -> do       b <- liftLua $ toboolean idx       return $ if b then Success else Failure "???"-    _ -> typeMismatchMessage "string or boolean" idx >>= failPeek+    _ -> Failure <$!>+         (liftLua (Lua.tostring' idx) *> peekString top) `lastly` pop 1
src/Test/Tasty/Lua/Module.hs view
@@ -2,9 +2,9 @@ {-# LANGUAGE TemplateHaskell #-} {-| Module      : Test.Tasty.Lua.Module-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>  Tasty Lua module, providing the functions necessary to write tasty tests in Lua scripts.
src/Test/Tasty/Lua/Translate.hs view
@@ -1,8 +1,8 @@ {-| Module      : Test.Tasty.Lua.Translate-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>  Translate test results from Lua into a Tasty @'TestTree'@. -}
tasty-lua.cabal view
@@ -1,27 +1,26 @@ cabal-version:       2.2 name:                tasty-lua-version:             1.0.2+version:             1.1.0 synopsis:            Write tests in Lua, integrate into tasty. description:         Allow users to define tasty tests from Lua. homepage:            https://github.com/hslua/hslua license:             MIT license-file:        LICENSE author:              Albert Krewinkel-maintainer:          albert+hslua@zeitkraut.de-copyright:           © 2019–2022 Albert Krewinkel <albert+hslua@zeitkraut.de>+maintainer:          tarleb@hslua.org+copyright:           © 2019-2023 Albert Krewinkel <tarleb@hslua.org> category:            Foreign build-type:          Simple extra-source-files:  CHANGELOG.md                    , tasty.lua                    , test/test-tasty.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.3                    , GHC == 8.10.7-                   , GHC == 9.0.1-                   , GHC == 9.2.1+                   , GHC == 9.0.2+                   , GHC == 9.2.5+                   , GHC == 9.4.4  source-repository head   type:              git@@ -30,10 +29,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-                     , hslua-core        >= 2.0    && < 2.3-                     , hslua-marshalling >= 2.0    && < 2.3+                     , hslua-core        >= 2.3    && < 2.4+                     , hslua-marshalling >= 2.0    && < 2.4                      , lua-arbitrary     >= 1.0    && < 1.1                      , tasty             >= 1.2    && < 1.5                      , QuickCheck        >= 2.9    && < 2.15
test/test-tasty-lua.hs view
@@ -2,9 +2,9 @@ {-# LANGUAGE TypeApplications #-} {-| Module      : Main-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>  Tests for the @tasty@ Lua module. -}