diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 22:05:24 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 22:22:55 -0700 |
commit | bc06ef0edb79b1b1fbaef8dffec223285ac72b3a (patch) | |
tree | 024feb87a8a777fd8138c483216ae9257ad95a4a /tests | |
parent | 19daf6cf0a336e0ffa08b2fb0e0c9932d6fef2a6 (diff) | |
parent | cfd8c0214c3f369d0f8c6f033325c343b78c7659 (diff) | |
download | pandoc-bc06ef0edb79b1b1fbaef8dffec223285ac72b3a.tar.gz |
Merge branch 'newbranch' of https://github.com/mpickering/pandoc into mpickering-newbranch
Conflicts:
src/Text/Pandoc/Readers/EPUB.hs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Tests/Shared.hs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/Tests/Shared.hs b/tests/Tests/Shared.hs index c9e2e21f5..b6671835c 100644 --- a/tests/Tests/Shared.hs +++ b/tests/Tests/Shared.hs @@ -6,7 +6,7 @@ import Test.Framework import Tests.Helpers import Tests.Arbitrary() import Test.Framework.Providers.HUnit -import Test.HUnit ( assertBool ) +import Test.HUnit ( assertBool, (@?=) ) import Text.Pandoc.Builder import Data.Monoid @@ -23,6 +23,7 @@ tests = [ testGroup "normalize" (let x = [(str "word", [para (str "def"), mempty])] in compactify'DL x == x) ] + , testGroup "collapseFilePath" testCollapse ] p_normalize_blocks_rt :: [Block] -> Bool @@ -36,3 +37,24 @@ p_normalize_inlines_rt ils = p_normalize_no_trailing_spaces :: [Inline] -> Bool p_normalize_no_trailing_spaces ils = null ils' || last ils' /= Space where ils' = normalizeInlines $ ils ++ [Space] + +testCollapse :: [Test] +testCollapse = map (testCase "collapse") + [ (collapseFilePath "" @?= "") + , (collapseFilePath "./foo" @?= "foo") + , (collapseFilePath "././../foo" @?= "../foo") + , (collapseFilePath "../foo" @?= "../foo") + , (collapseFilePath "/bar/../baz" @?= "/baz") + , (collapseFilePath "/../baz" @?= "/../baz") + , (collapseFilePath "./foo/.././bar/../././baz" @?= "baz") + , (collapseFilePath "./" @?= "") + , (collapseFilePath "././" @?= "") + , (collapseFilePath "../" @?= "..") + , (collapseFilePath ".././" @?= "..") + , (collapseFilePath "./../" @?= "..") + , (collapseFilePath "../../" @?= "../..") + , (collapseFilePath "parent/foo/baz/../bar" @?= "parent/foo/bar") + , (collapseFilePath "parent/foo/baz/../../bar" @?= "parent/bar") + , (collapseFilePath "parent/foo/.." @?= "parent") + , (collapseFilePath "/parent/foo/../../bar" @?= "/bar") + , (collapseFilePath "/./parent/foo" @?= "/parent/foo")] |