diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-05-29 12:05:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-29 12:05:04 -0400 |
commit | e871d65b67e2458c6146debddeaddb3c9773f67c (patch) | |
tree | 77665385be99be05e80f1cdbe5ea93c5e3f72baa /test/Tests | |
parent | 1de7b20ebbb198362ec0b4717f72d275fb34dd9c (diff) | |
parent | 505f5bf5d951a5c4342f7acce9bea5f260dc9d78 (diff) | |
download | pandoc-e871d65b67e2458c6146debddeaddb3c9773f67c.tar.gz |
Merge pull request #5526 from tarleb/richer-version-type
Lua: add Version type to simplify comparisons
Diffstat (limited to 'test/Tests')
-rw-r--r-- | test/Tests/Lua.hs | 13 | ||||
-rw-r--r-- | test/Tests/Lua/Module.hs | 3 |
2 files changed, 7 insertions, 9 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs index c585182e4..7a1261eb2 100644 --- a/test/Tests/Lua.hs +++ b/test/Tests/Lua.hs @@ -15,7 +15,6 @@ module Tests.Lua ( runLuaTest, tests ) where import Prelude import Control.Monad (when) -import Data.Version (Version (versionBranch)) import System.FilePath ((</>)) import Test.Tasty (TestTree, localOption) import Test.Tasty.HUnit (Assertion, assertEqual, testCase) @@ -34,6 +33,7 @@ import Text.Pandoc.Options (def) import Text.Pandoc.Shared (pandocVersion) import qualified Foreign.Lua as Lua +import qualified Data.ByteString.Char8 as BS tests :: [TestTree] tests = map (localOption (QuickCheckTests 20)) @@ -135,17 +135,14 @@ tests = map (localOption (QuickCheckTests 20)) (doc $ para (str $ "lua" </> "script-name.lua")) , testCase "Pandoc version is set" . runLuaTest $ do - Lua.getglobal' "table.concat" Lua.getglobal "PANDOC_VERSION" - Lua.push ("." :: String) -- separator - Lua.call 2 1 - Lua.liftIO . assertEqual "pandoc version is wrong" pandocVersion - =<< Lua.peek Lua.stackTop + Lua.liftIO . + assertEqual "pandoc version is wrong" (BS.pack pandocVersion) + =<< Lua.tostring' Lua.stackTop , testCase "Pandoc types version is set" . runLuaTest $ do - let versionNums = versionBranch pandocTypesVersion Lua.getglobal "PANDOC_API_VERSION" - Lua.liftIO . assertEqual "pandoc-types version is wrong" versionNums + Lua.liftIO . assertEqual "pandoc-types version is wrong" pandocTypesVersion =<< Lua.peek Lua.stackTop , testCase "Allow singleton inline in constructors" . runLuaTest $ do diff --git a/test/Tests/Lua/Module.hs b/test/Tests/Lua/Module.hs index 82c9330e5..324acce04 100644 --- a/test/Tests/Lua/Module.hs +++ b/test/Tests/Lua/Module.hs @@ -20,7 +20,8 @@ import Tests.Lua (runLuaTest) tests :: [TestTree] tests = [ testPandocLua "pandoc" ("lua" </> "module" </> "pandoc.lua") - , testPandocLua "pandoc.util" ("lua" </> "module" </> "pandoc.utils.lua") + , testPandocLua "pandoc.types" ("lua" </> "module" </> "pandoc-types.lua") + , testPandocLua "pandoc.util" ("lua" </> "module" </> "pandoc-utils.lua") ] testPandocLua :: TestName -> FilePath -> TestTree |