diff options
Diffstat (limited to 'bbcode/test/Text/BBCode')
-rw-r--r-- | bbcode/test/Text/BBCode/LexerSpec.hs | 7 |
1 files changed, 7 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 | ] |