Skip to content

Commit

Permalink
Add tests for earmark warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Jul 20, 2020
1 parent e7cb79c commit 64d392a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/ex_doc/markdown/earmark_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule ExDoc.Markdown.EarmarkTest do

@moduletag :earmark

describe "to_ast/1" do
describe "to_ast/2" do
test "generate AST" do
assert Markdown.to_ast("# Test\n\nHello", []) == [{:h1, [], ["Test"]}, {:p, [], ["Hello"]}]
assert Markdown.to_ast("[foo](bar)", []) == [{:p, [], [{:a, [href: "bar"], ["foo"]}]}]
Expand All @@ -20,6 +20,12 @@ defmodule ExDoc.Markdown.EarmarkTest do
assert Markdown.to_ast("<!-- INCLUDE -->", []) == []
end

test "warnings" do
assert ExUnit.CaptureIO.capture_io(:stderr, fn ->
Markdown.to_ast("`foo", [])
end) =~ "(warning) nofile:1 Closing unclosed backquotes ` at end of input"
end

test "bug #1222" do
assert ExUnit.CaptureIO.capture_io(:stderr, fn ->
assert [{:p, [], _}] =
Expand Down

0 comments on commit 64d392a

Please sign in to comment.