git.iko.soy/typeable/pandoc
on master help sign in
Added cCommented-out round-trip property in markdown reader test.
commitc686010a92f35eaba4056d502e47d875c9d98e94 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 4 Feb 2011, 18:33 (16 years ago) parent221177c
1 file changed+18
src/Tests/Readers/Markdown.hs+18
src/Tests/Readers/Markdown.hs+18
@@ -6,6 +6,7 @@ import Test.Framework
66import Tests.Helpers
77import Tests.Arbitrary()
88import Text.Pandoc.Builder
9+-- import Text.Pandoc.Shared ( normalize )
910import Text.Pandoc
1011
1112markdown :: String -> Pandoc
@@ -16,6 +17,19 @@ infix 5 =:
1617 => String -> (String, c) -> Test
1718(=:) = test markdown
1819
20+{-
21+p_markdown_round_trip :: Block -> Bool
22+p_markdown_round_trip b = matches d' d''
23+ where d' = normalize $ Pandoc (Meta [] [] []) [b]
24+ d'' = normalize
25+ $ readMarkdown defaultParserState{ stateSmart = True }
26+ $ writeMarkdown defaultWriterOptions d'
27+ matches (Pandoc _ [Plain []]) (Pandoc _ []) = True
28+ matches (Pandoc _ [Para []]) (Pandoc _ []) = True
29+ matches (Pandoc _ [Plain xs]) (Pandoc _ [Para xs']) = xs == xs'
30+ matches x y = x == y
31+-}
32+
1933tests :: [Test]
2034tests = [ testGroup "inline code"
2135 [ "with attribute" =:
@@ -34,4 +48,8 @@ tests = [ testGroup "inline code"
3448 "[^1]\n\n[^1]: my note\n \n in note\n"
3549 =?> para (note (para "my note" +++ para "in note"))
3650 ]
51+-- the round-trip properties frequently fail
52+-- , testGroup "round trip"
53+-- [ property "p_markdown_round_trip" p_markdown_round_trip
54+-- ]
3755 ]