1{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-}
2module Tests.Walk (tests) where
4import Text.Pandoc.Definition
8import Data.Char (toUpper)
9import Tests.Arbitrary()
13tests = [ testGroup "Walk"
14 [ property "p_walk inlineTrans" (p_walk inlineTrans)
15 , property "p_walk blockTrans" (p_walk blockTrans)
16 , property "p_query inlineQuery" (p_query inlineQuery)
17 , property "p_query blockQuery" (p_query blockQuery)
21p_walk :: (Typeable a, Walkable a Pandoc)
22 => (a -> a) -> Pandoc -> Bool
23p_walk f d = everywhere (mkT f) d == walk f d
25p_query :: (Eq a, Typeable a1, Monoid a, Walkable a1 Pandoc)
26 => (a1 -> a) -> Pandoc -> Bool
27p_query f d = everything mappend (mempty `mkQ` f) d == query f d
29inlineTrans :: Inline -> Inline
30inlineTrans (Str xs) = Str $ map toUpper xs
31inlineTrans (Emph xs) = Strong xs
34blockTrans :: Block -> Block
35blockTrans (Plain xs) = Para xs
36blockTrans (BlockQuote xs) = Div ("",["special"],[]) xs
39inlineQuery :: Inline -> String
40inlineQuery (Str xs) = xs
43blockQuery :: Block -> [Int]
44blockQuery (Header lev _ _) = [lev]
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