summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-02-06 03:17:31 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-02-12 17:30:57 +0300
commit8aed3652c2cb1811aa5685bbeb7c97b097b2eed4 (patch)
tree0e6e43e5c539c1c09d7d64be4abd07c61ba427b9 /test
parent10c8b9f4bbd78de75ebd134547445e9f1df13248 (diff)
Muse reader: refactor to avoid reparsing
Lists are parsed in linear instead of exponential time now. Contents of block tags, such as <quote>, is parsed directly, without storing it in a string and parsing with parseFromString. Fixed a bug: headers did not terminate lists.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Muse.hs41
1 files changed, 40 insertions, 1 deletions
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 60059df77..967a63ac9 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -313,6 +313,16 @@ tests =
, "</quote>"
]
=?> blockQuote (para $ text "Hello, world")
+ , "Nested quote tag" =:
+ T.unlines [ "<quote>"
+ , "foo"
+ , "<quote>"
+ , "bar"
+ , "</quote>"
+ , "baz"
+ , "</quote>"
+ ] =?>
+ blockQuote (para "foo" <> blockQuote (para "bar") <> para "baz")
, "Verse tag" =:
T.unlines [ "<verse>"
, ""
@@ -514,6 +524,12 @@ tests =
] =?>
header 2 "Foo" <>
para (spanWith ("bar", [], []) mempty)
+ , "Headers terminate lists" =:
+ T.unlines [ " - foo"
+ , "* bar"
+ ] =?>
+ bulletList [ para "foo" ] <>
+ header 1 "bar"
]
, testGroup "Directives"
[ "Title" =:
@@ -846,6 +862,15 @@ tests =
, para "c"
]
]
+ , "List continuation afeter nested list" =:
+ T.unlines
+ [ " - - foo"
+ , ""
+ , " bar"
+ ] =?>
+ bulletList [ bulletList [ para "foo" ] <>
+ para "bar"
+ ]
-- Emacs Muse allows to separate lists with two or more blank lines.
-- Text::Amuse (Amusewiki engine) always creates a single list as of version 0.82.
-- pandoc follows Emacs Muse behavior
@@ -1087,7 +1112,21 @@ tests =
, para "* Bar"
]
]
- , "List inside a tag" =:
+ , "Bullet list inside a tag" =:
+ T.unlines
+ [ "<quote>"
+ , " - First"
+ , ""
+ , " - Second"
+ , ""
+ , " - Third"
+ , "</quote>"
+ ] =?>
+ blockQuote (bulletList [ para "First"
+ , para "Second"
+ , para "Third"
+ ])
+ , "Ordered list inside a tag" =:
T.unlines
[ "<quote>"
, " 1. First"