-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
100c194
commit 58bb9c4
Showing
5 changed files
with
80 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
defmodule Test.Acceptance.Html.IllegalOptionsTest do | ||
use ExUnit.Case | ||
|
||
import ExUnit.CaptureIO | ||
import Earmark, only: [as_html: 2, as_html!: 2] | ||
|
||
describe "unrecognized options" do | ||
test "with empty" do | ||
messages = [ | ||
{:warning, 0, "Unrecognized option no_such_option: true ignored"} | ||
] | ||
assert as_html("", no_such_option: true) == {:error, "", messages} | ||
end | ||
test "with non empty" do | ||
messages = [ | ||
{:warning, 0, "Unrecognized option hello: 42 ignored"}, | ||
{:warning, 0, "Unrecognized option no_such_option: true ignored"}, | ||
] | ||
assert as_html("hello", no_such_option: true, hello: 42) == {:error, "", messages} | ||
end | ||
end | ||
|
||
test "with as_html!" do | ||
error_messages = | ||
capture_io(:stderr, fn -> | ||
as_html!("hello", oops: Earmark) | ||
end) | ||
assert error_messages == "<args>:0: warning: Unrecognized option oops: Earmark ignored\n" | ||
end | ||
end |