aboutsummaryrefslogtreecommitdiff
path: root/bbcode/test/Text/BBCode/LexerSpec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'bbcode/test/Text/BBCode/LexerSpec.hs')
-rw-r--r--bbcode/test/Text/BBCode/LexerSpec.hs18
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 <> "]"
27coToken (BBOpen t xs) = "[" <> escape [']'] t <> " " <> attrs <> " ]" 27coToken (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 <> "\""
32coToken (BBClose t) = "[/" <> escape [']'] t <> "]" 32coToken (BBClose t) = "[/" <> escape [']'] t <> "]"
33coToken (BBStr t) = escape ['['] t 33coToken (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 ]