1{-# LANGUAGE NoImplicitPrelude #-}
4 Copyright : © 2006-2019 John MacFarlane
5 License : GNU GPL, version 2 or above
7 Maintainer : John MacFarlane <jgm@berkeley@edu>
11Tests for functions used in many parts of the library.
13module Tests.Shared (tests) where
16import System.FilePath.Posix (joinPath)
18import Test.Tasty.HUnit (assertBool, testCase, (@?=))
19import Text.Pandoc.Arbitrary ()
20import Text.Pandoc.Builder
21import Text.Pandoc.Shared
24tests = [ testGroup "compactifyDL"
25 [ testCase "compactifyDL with empty def" $
26 assertBool "compactifyDL"
27 (let x = [(str "word", [para (str "def"), mempty])]
28 in compactifyDL x == x)
30 , testGroup "collapseFilePath" testCollapse
33testCollapse :: [TestTree]
34testCollapse = map (testCase "collapse")
35 [ collapseFilePath (joinPath [ ""]) @?= (joinPath [ ""])
36 , collapseFilePath (joinPath [ ".","foo"]) @?= (joinPath [ "foo"])
37 , collapseFilePath (joinPath [ ".",".","..","foo"]) @?= (joinPath [ joinPath ["..", "foo"]])
38 , collapseFilePath (joinPath [ "..","foo"]) @?= (joinPath [ "..","foo"])
39 , collapseFilePath (joinPath [ "","bar","..","baz"]) @?= (joinPath [ "","baz"])
40 , collapseFilePath (joinPath [ "","..","baz"]) @?= (joinPath [ "","..","baz"])
41 , collapseFilePath (joinPath [ ".","foo","..",".","bar","..",".",".","baz"]) @?= (joinPath [ "baz"])
42 , collapseFilePath (joinPath [ ".",""]) @?= (joinPath [ ""])
43 , collapseFilePath (joinPath [ ".",".",""]) @?= (joinPath [ ""])
44 , collapseFilePath (joinPath [ "..",""]) @?= (joinPath [ ".."])
45 , collapseFilePath (joinPath [ "..",".",""]) @?= (joinPath [ ".."])
46 , collapseFilePath (joinPath [ ".","..",""]) @?= (joinPath [ ".."])
47 , collapseFilePath (joinPath [ "..","..",""]) @?= (joinPath [ "..",".."])
48 , collapseFilePath (joinPath [ "parent","foo","baz","..","bar"]) @?= (joinPath [ "parent","foo","bar"])
49 , collapseFilePath (joinPath [ "parent","foo","baz","..","..","bar"]) @?= (joinPath [ "parent","bar"])
50 , collapseFilePath (joinPath [ "parent","foo",".."]) @?= (joinPath [ "parent"])
51 , collapseFilePath (joinPath [ "","parent","foo","..","..","bar"]) @?= (joinPath [ "","bar"])
52 , collapseFilePath (joinPath [ "",".","parent","foo"]) @?= (joinPath [ "","parent","foo"])]
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