Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/test/bbcode/parser_test.exs b/test/bbcode/parser_test.exs
index a798dbf..554f944 100644
--- a/test/bbcode/parser_test.exs
+++ b/test/bbcode/parser_test.exs
@@ -1,46 +1,59 @@
defmodule BBCode.Parser.Test do
use ExUnit.Case
alias BBCode.Parser
describe "simple tags" do
test "it parses [b] tags correctly" do
assert {:ok, [b: "testing"]} = Parser.parse("[b]testing[/b]")
end
test "it parses [i] tags correctly" do
assert {:ok, [i: "testing"]} = Parser.parse("[i]testing[/i]")
end
test "it parses [u] tags correctly" do
assert {:ok, [u: "testing"]} = Parser.parse("[u]testing[/u]")
end
test "it parses [s] tags correctly" do
assert {:ok, [s: "testing"]} = Parser.parse("[s]testing[/s]")
end
test "it parses [code] tags correctly" do
assert {:ok, [code: "testing"]} = Parser.parse("[code]testing[/code]")
end
test "it parses [quote] tags correctly" do
assert {:ok, [quote: "testing"]} = Parser.parse("[quote]testing[/quote]")
end
end
describe "nested tags" do
test "it parses [ul] lists correctly" do
assert {:ok, [ul: [li: "a", li: "b"]]} = Parser.parse("[ul][li]a[/li][li]b[/li][/ul]")
end
test "it parses [ol] lists correctly" do
assert {:ok, [ol: [li: "a", li: "b"]]} = Parser.parse("[ol][li]a[/li][li]b[/li][/ol]")
end
end
+ describe "multiline" do
+ test "it describes a multiline [li] list" do
+ data = """
+ [ul]
+ [li]a[/li]
+ [li]b[/li]
+ [/ul]
+ """
+
+ assert {:ok, [{:ul, ["\n", {:li, "a"}, "\n", {:li, "b"}, "\n"]}, "\n"]} = Parser.parse(data)
+ end
+ end
+
describe "invalid input" do
test "it fails to parse unterminated input" do
{:error, "expected end of string"} = Parser.parse("hello [b]world")
end
end
end

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 26, 9:10 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40484
Default Alt Text
(1 KB)

Event Timeline