Skip to content

Commit

Permalink
VIP - missing module name inside tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shahryarjb committed Dec 30, 2023
1 parent 0b60bf2 commit 480dd88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/macros/guarded_struct.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ defmodule GuardedStruct do
####################################################################

@spec create_error_module() :: Macro.t()
@doc false
defmacro create_error_module() do
quote do
defmodule Error do
Expand Down Expand Up @@ -1395,6 +1396,7 @@ defmodule GuardedStruct do
end

@spec conditional_field(atom(), any(), keyword(), [{:do, any()}]) :: Macro.t()
@doc false
defmacro conditional_field(name, type, opts \\ [], do: block) do
# type = Macro.escape(quote do: struct())
type = Macro.escape(type)
Expand Down Expand Up @@ -1870,6 +1872,7 @@ defmodule GuardedStruct do

@spec exceptions_handler({:ok, any()} | {:error, any(), any()}, module(), boolean()) ::
{:ok, any()} | {:error, any(), any()}
@doc false
def exceptions_handler(ouput, module, exception \\ false)

def exceptions_handler({:ok, _} = successful_output, _, _), do: successful_output
Expand Down Expand Up @@ -2506,6 +2509,7 @@ defmodule GuardedStruct do
end

@spec reduce_success_data_and_error_data(list(any())) :: list(any())
@doc false
def reduce_success_data_and_error_data(conds) do
Enum.reduce(conds, [[], []], fn
{{:ok, key, value}, opts}, [data, error] ->
Expand Down Expand Up @@ -2688,6 +2692,7 @@ defmodule GuardedStruct do
{any(), atom(), list(any()), map() | list(), atom(), :add | :edit, boolean()}
) ::
list() | {any(), list(), any()}
@doc false
def conditional_fields_validating_pattern(
{cond_data, field, list_values, full_attrs, key, type, true}
)
Expand Down
8 changes: 4 additions & 4 deletions test/guarded_struct_test/core_keys_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ defmodule MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest do

# TODO: check the error of :edit
{:ok,
%MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest.AllowedParentCustomDomain{
%__MODULE__.AllowedParentCustomDomain{
id: "https://github.com/mishka-group/mishka_developer_tools",
auth: %MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest.AllowedParentCustomDomain.Auth{
auth: %__MODULE__.AllowedParentCustomDomain.Auth{
action: "ok"
},
username: "mishka"
Expand All @@ -910,9 +910,9 @@ defmodule MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest do
)

{:ok,
%MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest.AllowedParentCustomDomain{
%__MODULE__.AllowedParentCustomDomain{
id: "9154b00d-4602-45c2-9562-46a2dcef257f",
auth: %MishkaDeveloperToolsTest.GuardedStruct.CoreKeysTest.AllowedParentCustomDomain.Auth{
auth: %__MODULE__.AllowedParentCustomDomain.Auth{
action: "ok"
},
username: "mishka"
Expand Down

0 comments on commit 480dd88

Please sign in to comment.