From 0b2ff85181bf314fc0ccffd0dc94055dccb4f264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20F=C3=B6hring?= Date: Thu, 2 Mar 2023 21:33:09 +0100 Subject: [PATCH] Add test reproducing #1029 --- test/credo/check/refactor/nesting_test.exs | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/test/credo/check/refactor/nesting_test.exs b/test/credo/check/refactor/nesting_test.exs index 550a2fb27..01365885d 100644 --- a/test/credo/check/refactor/nesting_test.exs +++ b/test/credo/check/refactor/nesting_test.exs @@ -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 @@ -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 @@ -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 @@ -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