1{-# Language OverloadedStrings #-}
2module Tests.Lua ( tests ) where
4import System.FilePath ((</>))
5import Test.Tasty (TestTree)
6import Test.Tasty.HUnit (Assertion, assertEqual, testCase)
7import Text.Pandoc.Builder
12 [ testCase "macro expansion via filter" $
13 assertFilterConversion "a '{{helloworld}}' string is expanded"
15 (doc . para $ str "{{helloworld}}")
16 (doc . para . emph $ str "Hello, World")
18 , testCase "convert all plains to paras" $
19 assertFilterConversion "plains become para"
21 (doc $ bulletList [plain (str "alfa"), plain (str "bravo")])
22 (doc $ bulletList [para (str "alfa"), para (str "bravo")])
24 , testCase "make hello world document" $
25 assertFilterConversion "Document contains 'Hello, World!'"
27 (doc . para $ str "Hey!" <> linebreak <> str "What's up?")
28 (doc . para $ str "Hello," <> space <> str "World!")
30 , testCase "parse raw markdown blocks" $
31 assertFilterConversion "raw markdown block is converted"
33 (doc $ rawBlock "markdown" "*charly* **delta**")
34 (doc . para $ emph "charly" <> space <> strong "delta")
37assertFilterConversion :: String -> FilePath -> Pandoc -> Pandoc -> Assertion
38assertFilterConversion msg filterPath docIn docExpected = do
39 docRes <- runLuaFilter ("lua" </> filterPath) [] docIn
40 assertEqual msg docExpected docRes
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list