diff options
Diffstat (limited to 'bbcode/test')
-rw-r--r-- | bbcode/test/Text/BBCode/LexerSpec.hs | 7 | ||||
-rw-r--r-- | bbcode/test/Text/BBCodeSpec.hs | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/bbcode/test/Text/BBCode/LexerSpec.hs b/bbcode/test/Text/BBCode/LexerSpec.hs index e225fab..117006c 100644 --- a/bbcode/test/Text/BBCode/LexerSpec.hs +++ b/bbcode/test/Text/BBCode/LexerSpec.hs | |||
@@ -32,6 +32,7 @@ coToken (BBOpen t xs) = "[" <> escape [']'] t <> " " <> attrs <> " ]" | |||
32 | coToken (BBContained t xs) = (<> "/]") . T.init . coToken $ BBOpen t xs | 32 | coToken (BBContained t xs) = (<> "/]") . T.init . coToken $ BBOpen t xs |
33 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" | 33 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" |
34 | coToken (BBStr t) = escape ['['] t | 34 | coToken (BBStr t) = escape ['['] t |
35 | coToken BBNewPar = "\n\n" | ||
35 | 36 | ||
36 | escape :: [Char] -> Text -> Text | 37 | escape :: [Char] -> Text -> Text |
37 | -- ^ Inverse of `escapedText` | 38 | -- ^ Inverse of `escapedText` |
@@ -108,4 +109,10 @@ examples = [ ("[t]test[/t]" | |||
108 | , [BBContained "br" [("attr", "val"), ("val2", "")]]) | 109 | , [BBContained "br" [("attr", "val"), ("val2", "")]]) |
109 | , ("[foo\\/bar]" | 110 | , ("[foo\\/bar]" |
110 | , [BBOpen "foo/bar" []]) | 111 | , [BBOpen "foo/bar" []]) |
112 | , ("foo\nbar" | ||
113 | , [BBStr "foo\nbar"]) | ||
114 | , ("foo\n\nbar" | ||
115 | , [BBStr "foo", BBNewPar, BBStr "bar"]) | ||
116 | , ("foo\n\n\r\n\r\nbar" | ||
117 | , [BBStr "foo", BBNewPar, BBStr "bar"]) | ||
111 | ] | 118 | ] |
diff --git a/bbcode/test/Text/BBCodeSpec.hs b/bbcode/test/Text/BBCodeSpec.hs index 0d8949a..e24c661 100644 --- a/bbcode/test/Text/BBCodeSpec.hs +++ b/bbcode/test/Text/BBCodeSpec.hs | |||
@@ -55,5 +55,9 @@ examples = [ ("[t]test[/t]" | |||
55 | , [Element "br" [("attr", "val")] []]) | 55 | , [Element "br" [("attr", "val")] []]) |
56 | , ("[br attr=val val2/]" | 56 | , ("[br attr=val val2/]" |
57 | , [Element "br" [("attr", "val"), ("val2", "")] []]) | 57 | , [Element "br" [("attr", "val"), ("val2", "")] []]) |
58 | , ("foo\n\nbar" | ||
59 | , [Paragraph [Content "foo"], Paragraph [Content "bar"]]) | ||
60 | , ("[b]foo\n\nbar[/b]" | ||
61 | , [Element "b" [] [Paragraph [Content "foo"], Paragraph [Content "bar"]]]) | ||
58 | ] | 62 | ] |
59 | 63 | ||