Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Commit

Permalink
fix the wrong format of doctest.
Browse files Browse the repository at this point in the history
  • Loading branch information
silathdiir committed Sep 30, 2017
1 parent 438d535 commit f97a72e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions lib/rat_error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ defmodule RatError do
Parameter 'opts' merges with the configuration in 'config/test.exs'.
iex> opts = [keys: [:code, :message]]
iex> rat_error(:wrong_password, "Wrong password!", opts)
%{error: %{code: :wrong_password, message: "Wrong password!"}}
iex> opts = [keys: [:code, :message]]
iex> rat_error(:wrong_password, "Wrong password!", opts)
%{error: %{code: :wrong_password, message: "Wrong password!"}}
"""
defmacro rat_error(error_code \\ nil, error_message \\ "", opts \\ []) do
Expand Down
16 changes: 8 additions & 8 deletions lib/rat_error/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ defmodule RatError.Formatter do
## Examples
iex> structure = %Structure{node: :err, keys: [:code, :message]}
iex> message = "Bad response!"
iex> Formatter.format(structure, __ENV__, :bad_response, message)
%{err: %{code: :bad_response, message: "Bad response!"}}
iex> structure = %Structure{node: :err, keys: [:code, :message]}
iex> message = "Bad response!"
iex> Formatter.format(structure, __ENV__, :bad_response, message)
%{err: %{code: :bad_response, message: "Bad response!"}}
iex> structure = %Structure{keys: [:code, :message]}
iex> message = "Out of memory!"
iex> Formatter.format(structure, __ENV__, :no_memory, message)
%{code: :no_memory, message: "Out of memory!"}
iex> structure = %Structure{keys: [:code, :message]}
iex> message = "Out of memory!"
iex> Formatter.format(structure, __ENV__, :no_memory, message)
%{code: :no_memory, message: "Out of memory!"}
"""
def format(%Structure{} = structure,
Expand Down
92 changes: 46 additions & 46 deletions lib/rat_error/structure.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ defmodule RatError.Structure do
References 'config/test.exs' for the test configuration.
iex> Structure.create_from_default_config
%RatError.Structure
{
node: :error,
prefix: nil,
keys:
[
:code,
:file,
:function,
:line,
:message,
:module
]
}
iex> Structure.create_from_default_config
%RatError.Structure
{
node: :error,
prefix: nil,
keys:
[
:code,
:file,
:function,
:line,
:message,
:module
]
}
"""
def create_from_default_config do
Expand All @@ -77,29 +77,29 @@ defmodule RatError.Structure do
## Examples
iex> Structure.create(node: :err, keys: [:code, :message])
%RatError.Structure
{
node: :err,
prefix: nil,
keys: [:code, :message]
}
iex> Structure.create(prefix: :err, keys: [:code, :message])
%RatError.Structure
{
node: nil,
prefix: :err,
keys: [:code, :message]
}
iex> Structure.create(keys: :code)
%RatError.Structure
{
node: nil,
prefix: nil,
keys: [:code]
}
iex> Structure.create(node: :err, keys: [:code, :message])
%RatError.Structure
{
node: :err,
prefix: nil,
keys: [:code, :message]
}
iex> Structure.create(prefix: :err, keys: [:code, :message])
%RatError.Structure
{
node: nil,
prefix: :err,
keys: [:code, :message]
}
iex> Structure.create(keys: :code)
%RatError.Structure
{
node: nil,
prefix: nil,
keys: [:code]
}
"""
def create(opts) when is_list(opts) do
Expand All @@ -113,14 +113,14 @@ defmodule RatError.Structure do
## Examples
iex> structure = %Structure{node: :err, keys: [:code]}
iex> Structure.update(structure, node: :error, prefix: :err, keys: :message)
%RatError.Structure
{
node: :error,
prefix: :err,
keys: [:message]
}
iex> structure = %Structure{node: :error, keys: [:code]}
iex> Structure.update(structure, node: :err, prefix: :err, keys: :message)
%RatError.Structure
{
node: :err,
prefix: :err,
keys: [:message]
}
"""
def update(%Structure{} = structure, opts) when is_list(opts) do
Expand Down

0 comments on commit f97a72e

Please sign in to comment.