diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-07 14:06:34 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-07 14:06:34 +0100 |
commit | f5dec4bdc12e5ba895458ba117e0966a78b3c790 (patch) | |
tree | 05963f97344999ef8be141345e2dcbcd95a30bd6 /test | |
parent | 043740d32baa9bf5c58409c2a8ace5a196283fa8 (diff) |
Lua: make pandoc-types version available as PANDOC_API_VERSION
The current pandoc-types version is made available to Lua programs in
the global PANDOC_API_VERSION. It contains the version as a list of
numbers.
Diffstat (limited to 'test')
-rw-r--r-- | test/Tests/Lua.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs index 058d5722b..0f6619240 100644 --- a/test/Tests/Lua.hs +++ b/test/Tests/Lua.hs @@ -2,6 +2,7 @@ module Tests.Lua ( tests ) where import Control.Monad (when) +import Data.Version (Version (versionBranch)) import System.FilePath ((</>)) import Test.Tasty (TestTree, localOption) import Test.Tasty.HUnit (Assertion, assertEqual, testCase) @@ -11,7 +12,7 @@ import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph, header, linebreak, para, plain, rawBlock, singleQuoted, space, str, strong, (<>)) import Text.Pandoc.Class (runIOorExplode, setUserDataDir) -import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc) +import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc, pandocTypesVersion) import Text.Pandoc.Lua (runLuaFilter, runPandocLua) import Text.Pandoc.Shared (pandocVersion) @@ -115,6 +116,12 @@ tests = map (localOption (QuickCheckTests 20)) Lua.call 2 1 Lua.liftIO . assertEqual "pandoc version is wrong" pandocVersion =<< Lua.peek Lua.stackTop + + , testCase "Pandoc types version is set" . runPandocLua' $ do + let versionNums = versionBranch pandocTypesVersion + Lua.getglobal "PANDOC_API_VERSION" + Lua.liftIO . assertEqual "pandoc version is wrong" versionNums + =<< Lua.peek Lua.stackTop ] assertFilterConversion :: String -> FilePath -> Pandoc -> Pandoc -> Assertion |