Skip to content

Commit

Permalink
refactor: better ergonomics on test macros
Browse files Browse the repository at this point in the history
  • Loading branch information
gp-pereira committed Dec 9, 2024
1 parent 316c17f commit 514a968
Show file tree
Hide file tree
Showing 29 changed files with 99 additions and 100 deletions.
4 changes: 2 additions & 2 deletions test/refactor/alias/expand_aliases_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ defmodule Refactorex.Refactor.Alias.ExpandAliasesTest do
end

test "ignores outside module" do
assert_not_refactored(
assert_ignored(
ExpandAliases,
"""
# v
Expand All @@ -128,7 +128,7 @@ defmodule Refactorex.Refactor.Alias.ExpandAliasesTest do
end

test "ignores outside alias" do
assert_not_refactored(
assert_ignored(
ExpandAliases,
"""
defmodule Foo do
Expand Down
8 changes: 4 additions & 4 deletions test/refactor/alias/extract_alias_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ defmodule Refactorex.Refactor.Alias.ExtractAliasTest do
end

test "ignores alias declaration" do
assert_not_refactored(
assert_ignored(
ExtractAlias,
"""
defmodule Foo do
Expand All @@ -127,7 +127,7 @@ defmodule Refactorex.Refactor.Alias.ExtractAliasTest do
end

test "ignores single alias" do
assert_not_refactored(
assert_ignored(
ExtractAlias,
"""
defmodule Foo do
Expand All @@ -142,7 +142,7 @@ defmodule Refactorex.Refactor.Alias.ExtractAliasTest do
end

test "ignores if there would be a name conflict" do
assert_not_refactored(
assert_ignored(
ExtractAlias,
"""
defmodule Foo do
Expand All @@ -159,7 +159,7 @@ defmodule Refactorex.Refactor.Alias.ExtractAliasTest do
end

test "ignores outside module" do
assert_not_refactored(
assert_ignored(
ExtractAlias,
"""
def foo() do
Expand Down
4 changes: 2 additions & 2 deletions test/refactor/alias/inline_alias_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ defmodule Refactorex.Refactor.Alias.InlineAliasTest do
end

test "ignores alias declaration" do
assert_not_refactored(
assert_ignored(
InlineAlias,
"""
defmodule Foo do
Expand All @@ -205,7 +205,7 @@ defmodule Refactorex.Refactor.Alias.InlineAliasTest do
end

test "ignores aliases without same module declaration" do
assert_not_refactored(
assert_ignored(
InlineAlias,
"""
defmodule Foo do
Expand Down
8 changes: 4 additions & 4 deletions test/refactor/alias/merge_aliases_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ defmodule Refactorex.Refactor.Alias.MergeAliasesTest do
end

test "ignores single alias" do
assert_not_refactored(
assert_ignored(
MergeAliases,
"""
defmodule Foo do
Expand All @@ -242,7 +242,7 @@ defmodule Refactorex.Refactor.Alias.MergeAliasesTest do
end

test "ignores unmergeable aliases" do
assert_not_refactored(
assert_ignored(
MergeAliases,
"""
defmodule Foo do
Expand All @@ -256,7 +256,7 @@ defmodule Refactorex.Refactor.Alias.MergeAliasesTest do
end

test "ignores outside alias" do
assert_not_refactored(
assert_ignored(
MergeAliases,
"""
defmodule Foo do
Expand All @@ -271,7 +271,7 @@ defmodule Refactorex.Refactor.Alias.MergeAliasesTest do
end

test "ignores partially selected alias" do
assert_not_refactored(
assert_ignored(
MergeAliases,
"""
defmodule Foo do
Expand Down
4 changes: 2 additions & 2 deletions test/refactor/alias/sort_nested_aliases_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ defmodule Refactorex.Refactor.Alias.SortNestedAliasesTest do
end

test "ignores alias without nesting" do
assert_not_refactored(
assert_ignored(
SortNestedAliases,
"""
# v
Expand All @@ -72,7 +72,7 @@ defmodule Refactorex.Refactor.Alias.SortNestedAliasesTest do
end

test "ignores already sorted alias" do
assert_not_refactored(
assert_ignored(
SortNestedAliases,
"""
# v
Expand Down
12 changes: 6 additions & 6 deletions test/refactor/constant/extract_constant_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores constants" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
defmodule Foo do
Expand All @@ -180,7 +180,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores anonymous function" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
defmodule Foo do
Expand All @@ -197,7 +197,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores selection ranges with variables" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
defmodule Foo do
Expand All @@ -212,7 +212,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores pipe function calls" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
defmodule Foo do
Expand All @@ -227,7 +227,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores selection ranges outside modules" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
# v
Expand All @@ -238,7 +238,7 @@ defmodule Refactorex.Refactor.Constant.ExtractConstantTest do
end

test "ignores alias" do
assert_not_refactored(
assert_ignored(
ExtractConstant,
"""
defmodule Foo do
Expand Down
4 changes: 2 additions & 2 deletions test/refactor/constant/inline_constant_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defmodule Refactorex.Refactor.Constant.InlineConstantTest do
end

test "ignores the constant definition" do
assert_not_refactored(
assert_ignored(
InlineConstant,
"""
defmodule Foo do
Expand All @@ -73,7 +73,7 @@ defmodule Refactorex.Refactor.Constant.InlineConstantTest do
end

test "ignores constant without a previous definition" do
assert_not_refactored(
assert_ignored(
InlineConstant,
"""
defmodule Foo do
Expand Down
2 changes: 1 addition & 1 deletion test/refactor/constant/rename_constant_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ defmodule Refactorex.Refactor.Constant.RenameConstantTest do
end

test "ignores variables" do
assert_not_refactored(
assert_ignored(
RenameConstant,
"""
defmodule Foo do
Expand Down
10 changes: 5 additions & 5 deletions test/refactor/function/collapse_anonymous_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Refactorex.Refactor.Function.CollapseAnonymousFunctionTest do
end

test "ignores anonymous function with pattern matching" do
assert_not_refactored(
assert_ignored(
CollapseAnonymousFunction,
"""
# v
Expand All @@ -56,7 +56,7 @@ defmodule Refactorex.Refactor.Function.CollapseAnonymousFunctionTest do
end

test "ignores anonymous function with multiples statements" do
assert_not_refactored(
assert_ignored(
CollapseAnonymousFunction,
"""
# v
Expand All @@ -70,7 +70,7 @@ defmodule Refactorex.Refactor.Function.CollapseAnonymousFunctionTest do
end

test "ignores anonymous function with multiples clauses" do
assert_not_refactored(
assert_ignored(
CollapseAnonymousFunction,
"""
# v
Expand All @@ -84,7 +84,7 @@ defmodule Refactorex.Refactor.Function.CollapseAnonymousFunctionTest do
end

test "ignores anonymous function with zero args" do
assert_not_refactored(
assert_ignored(
CollapseAnonymousFunction,
"""
def foo do
Expand All @@ -97,7 +97,7 @@ defmodule Refactorex.Refactor.Function.CollapseAnonymousFunctionTest do
end

test "ignores anonymous function with unused args" do
assert_not_refactored(
assert_ignored(
CollapseAnonymousFunction,
"""
def foo do
Expand Down
2 changes: 1 addition & 1 deletion test/refactor/function/expand_anonymous_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defmodule Refactorex.Refactor.Function.ExpandAnonymousFunctionTest do
end

test "ignores capture variables" do
assert_not_refactored(
assert_ignored(
ExpandAnonymousFunction,
"""
def foo(modules) do
Expand Down
6 changes: 3 additions & 3 deletions test/refactor/function/extract_anonymous_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ defmodule Refactorex.Refactor.Function.ExtractAnonymousFunctionTest do
end

test "ignores anonymous function that is not inside a module" do
assert_not_refactored(
assert_ignored(
ExtractAnonymousFunction,
"""
def power_sum(numbers, power) do
Expand All @@ -463,7 +463,7 @@ defmodule Refactorex.Refactor.Function.ExtractAnonymousFunctionTest do
end

test "ignores anonymous function with zero arguments" do
assert_not_refactored(
assert_ignored(
ExtractAnonymousFunction,
"""
defmodule Middleware do
Expand All @@ -478,7 +478,7 @@ defmodule Refactorex.Refactor.Function.ExtractAnonymousFunctionTest do
end

test "ignores already extracted function" do
assert_not_refactored(
assert_ignored(
ExtractAnonymousFunction,
"""
defmodule Foo do
Expand Down
10 changes: 5 additions & 5 deletions test/refactor/function/extract_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ defmodule Refactorex.Refactor.Function.ExtractFunctionTest do
end

test "ignore with clauses" do
assert_not_refactored(
assert_ignored(
ExtractFunction,
"""
defmodule Foo do
Expand All @@ -211,7 +211,7 @@ defmodule Refactorex.Refactor.Function.ExtractFunctionTest do
end

test "ignore module constants" do
assert_not_refactored(
assert_ignored(
ExtractFunction,
"""
defmodule Foo do
Expand All @@ -228,7 +228,7 @@ defmodule Refactorex.Refactor.Function.ExtractFunctionTest do
end

test "ignore anonymous functions" do
assert_not_refactored(
assert_ignored(
ExtractFunction,
"""
defmodule Foo do
Expand All @@ -245,7 +245,7 @@ defmodule Refactorex.Refactor.Function.ExtractFunctionTest do
end

test "ignore variable declaration functions" do
assert_not_refactored(
assert_ignored(
ExtractFunction,
"""
defmodule Foo do
Expand All @@ -262,7 +262,7 @@ defmodule Refactorex.Refactor.Function.ExtractFunctionTest do
end

test "ignores alias" do
assert_not_refactored(
assert_ignored(
ExtractFunction,
"""
defmodule Foo do
Expand Down
6 changes: 3 additions & 3 deletions test/refactor/function/inline_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ defmodule Refactorex.Refactor.Function.InlineFunctionTest do
end

test "ignores function definition" do
assert_not_refactored(
assert_ignored(
InlineFunction,
"""
defmodule Foo do
Expand All @@ -553,7 +553,7 @@ defmodule Refactorex.Refactor.Function.InlineFunctionTest do
end

test "ignores function call without same module definition" do
assert_not_refactored(
assert_ignored(
InlineFunction,
"""
defmodule Foo do
Expand All @@ -568,7 +568,7 @@ defmodule Refactorex.Refactor.Function.InlineFunctionTest do
end

test "ignores function call outside module" do
assert_not_refactored(
assert_ignored(
InlineFunction,
"""
def foo(arg) do
Expand Down
4 changes: 2 additions & 2 deletions test/refactor/function/rename_function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ defmodule Refactorex.Refactor.Function.RenameFunctionTest do
end

test "ignores function when the definition cannot be found" do
assert_not_refactored(
assert_ignored(
RenameFunction,
"""
defmodule Foo do
Expand All @@ -227,7 +227,7 @@ defmodule Refactorex.Refactor.Function.RenameFunctionTest do
end

test "ignores selection outside module" do
assert_not_refactored(
assert_ignored(
RenameFunction,
"""
def foo(arg) do
Expand Down
Loading

0 comments on commit 514a968

Please sign in to comment.