2011-01-29 19:03:00 +01:00
|
|
|
module Tests.Shared (tests) where
|
|
|
|
|
|
|
|
import Text.Pandoc.Definition
|
|
|
|
import Text.Pandoc.Shared
|
|
|
|
import Test.Framework
|
|
|
|
import Tests.Helpers
|
|
|
|
import Tests.Arbitrary()
|
|
|
|
|
|
|
|
tests :: [Test]
|
|
|
|
tests = [ testGroup "normalize"
|
|
|
|
[ property "p_normalize_blocks_rt" p_normalize_blocks_rt
|
|
|
|
, property "p_normalize_inlines_rt" p_normalize_inlines_rt
|
2011-02-04 22:22:31 +01:00
|
|
|
, property "p_normalize_no_trailing_spaces"
|
|
|
|
p_normalize_no_trailing_spaces
|
2011-01-29 19:03:00 +01:00
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
p_normalize_blocks_rt :: [Block] -> Bool
|
2014-06-30 08:03:12 +02:00
|
|
|
p_normalize_blocks_rt bs =
|
|
|
|
normalizeBlocks bs == normalizeBlocks (normalizeBlocks bs)
|
2011-01-29 19:03:00 +01:00
|
|
|
|
|
|
|
p_normalize_inlines_rt :: [Inline] -> Bool
|
2014-06-30 08:03:12 +02:00
|
|
|
p_normalize_inlines_rt ils =
|
|
|
|
normalizeInlines ils == normalizeInlines (normalizeInlines ils)
|
2011-01-29 19:03:00 +01:00
|
|
|
|
2011-02-04 22:22:31 +01:00
|
|
|
p_normalize_no_trailing_spaces :: [Inline] -> Bool
|
|
|
|
p_normalize_no_trailing_spaces ils = null ils' || last ils' /= Space
|
2014-06-30 08:03:12 +02:00
|
|
|
where ils' = normalizeInlines $ ils ++ [Space]
|