diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 09:39:42 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 09:39:42 +0100 |
commit | 478bc6572d3ba508bddf1fdcf697e5a9e56e4055 (patch) | |
tree | 8470747547cdc304c7573b4c5545119ea3e3374b /bbcode/test | |
parent | 07759433a7e075e99267e2ea04f232c99118c9fd (diff) | |
download | thermoprint-478bc6572d3ba508bddf1fdcf697e5a9e56e4055.tar thermoprint-478bc6572d3ba508bddf1fdcf697e5a9e56e4055.tar.gz thermoprint-478bc6572d3ba508bddf1fdcf697e5a9e56e4055.tar.bz2 thermoprint-478bc6572d3ba508bddf1fdcf697e5a9e56e4055.tar.xz thermoprint-478bc6572d3ba508bddf1fdcf697e5a9e56e4055.zip |
DomTree
Diffstat (limited to 'bbcode/test')
-rw-r--r-- | bbcode/test/Text/BBCode/LexerSpec.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bbcode/test/Text/BBCode/LexerSpec.hs b/bbcode/test/Text/BBCode/LexerSpec.hs index fcc1c4f..5c4b89e 100644 --- a/bbcode/test/Text/BBCode/LexerSpec.hs +++ b/bbcode/test/Text/BBCode/LexerSpec.hs | |||
@@ -27,8 +27,8 @@ coToken (BBOpen t []) = "[" <> escape [']'] t <> "]" | |||
27 | coToken (BBOpen t xs) = "[" <> escape [']'] t <> " " <> attrs <> " ]" | 27 | coToken (BBOpen t xs) = "[" <> escape [']'] t <> " " <> attrs <> " ]" |
28 | where | 28 | where |
29 | attrs = mconcat . intersperse " " $ map attr xs | 29 | attrs = mconcat . intersperse " " $ map attr xs |
30 | attr (key, Nothing) = escape ['=', ']', ' '] key | 30 | attr (key, "") = escape ['=', ']', ' '] key |
31 | attr (key, Just val) = escape ['=', ']', ' '] key <> "=\"" <> escape ['\"'] val <> "\"" | 31 | attr (key, val) = escape ['=', ']', ' '] key <> "=\"" <> escape ['\"'] val <> "\"" |
32 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" | 32 | coToken (BBClose t) = "[/" <> escape [']'] t <> "]" |
33 | coToken (BBStr t) = escape ['['] t | 33 | coToken (BBStr t) = escape ['['] t |
34 | 34 | ||
@@ -82,17 +82,17 @@ examples = [ ("[t]test[/t]" | |||
82 | , ("[t]test[/t\\]]" | 82 | , ("[t]test[/t\\]]" |
83 | , [BBOpen "t" [], BBStr "test", BBClose "t]"]) | 83 | , [BBOpen "t" [], BBStr "test", BBClose "t]"]) |
84 | , ("[t attr]test[/t]" | 84 | , ("[t attr]test[/t]" |
85 | , [BBOpen "t" [("attr", Nothing)], BBStr "test", BBClose "t"]) | 85 | , [BBOpen "t" [("attr", "")], BBStr "test", BBClose "t"]) |
86 | , ("[t=attr]test[/t]" | 86 | , ("[t=attr]test[/t]" |
87 | , [BBOpen "t" [("", Just "attr")], BBStr "test", BBClose "t"]) | 87 | , [BBOpen "t" [("", "attr")], BBStr "test", BBClose "t"]) |
88 | , ("[t attr=val]test[/t]" | 88 | , ("[t attr=val]test[/t]" |
89 | , [BBOpen "t" [("attr", Just "val")], BBStr "test", BBClose "t"]) | 89 | , [BBOpen "t" [("attr", "val")], BBStr "test", BBClose "t"]) |
90 | , ("[t attr=\"val\"]test[/t]" | 90 | , ("[t attr=\"val\"]test[/t]" |
91 | , [BBOpen "t" [("attr", Just "val")], BBStr "test", BBClose "t"]) | 91 | , [BBOpen "t" [("attr", "val")], BBStr "test", BBClose "t"]) |
92 | , ("[t attr=\"va]l\"]test[/t]" | 92 | , ("[t attr=\"va]l\"]test[/t]" |
93 | , [BBOpen "t" [("attr", Just "va]l")], BBStr "test", BBClose "t"]) | 93 | , [BBOpen "t" [("attr", "va]l")], BBStr "test", BBClose "t"]) |
94 | , ("[t attr=\"va\\\"l\"]test[/t]" | 94 | , ("[t attr=\"va\\\"l\"]test[/t]" |
95 | , [BBOpen "t" [("attr", Just "va\"l")], BBStr "test", BBClose "t"]) | 95 | , [BBOpen "t" [("attr", "va\"l")], BBStr "test", BBClose "t"]) |
96 | , ("[t attr=\"val\" attr2=\"val2\" ]test[/t]" | 96 | , ("[t attr=\"val\" attr2=\"val2\" ]test[/t]" |
97 | , [BBOpen "t" [("attr", Just "val"), ("attr2", Just "val2")], BBStr "test", BBClose "t"]) | 97 | , [BBOpen "t" [("attr", "val"), ("attr2", "val2")], BBStr "test", BBClose "t"]) |
98 | ] | 98 | ] |