Skip to content

Commit

Permalink
Add test reproducing #1029
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Mar 2, 2023
1 parent 5c9e568 commit 0b2ff85
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions test/credo/check/refactor/nesting_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ defmodule Credo.Check.Refactor.NestingTest do
|> assert_issue()
end

test "it should report a violation 2" do
test "it should report a violation /2" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, parameter2) do
Expand All @@ -108,7 +108,7 @@ defmodule Credo.Check.Refactor.NestingTest do
|> assert_issue()
end

test "it should report a violation 3" do
test "it should report a violation /3" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, parameter2) do
Expand All @@ -127,7 +127,7 @@ defmodule Credo.Check.Refactor.NestingTest do
|> assert_issue()
end

test "it should report a violation 4" do
test "it should report a violation /4" do
"""
defmodule CredoSampleModule do
def some_function(parameter1, parameter2) do
Expand All @@ -147,4 +147,27 @@ defmodule Credo.Check.Refactor.NestingTest do
|> run_check(@described_check)
|> assert_issue()
end

test "it should report a violation /5" do
"""
defmodule CredoSampleModule do
defp foo() do
if true do
if true do
if true do
if true do
"nested"
end
end
end
else
"flat"
end
end
end
"""
|> to_source_file
|> run_check(@described_check)
|> assert_issue()
end
end

0 comments on commit 0b2ff85

Please sign in to comment.