diff --git a/test/credo/check/readability/module_doc_test.exs b/test/credo/check/readability/module_doc_test.exs index a8c08a1ee..340f69707 100644 --- a/test/credo/check/readability/module_doc_test.exs +++ b/test/credo/check/readability/module_doc_test.exs @@ -53,6 +53,21 @@ defmodule Credo.Check.Readability.ModuleDocTest do |> refute_issues() end + test "it should NOT report modules or submodules when @moduledoc is present" do + """ + defmodule Foo do + @moduledoc false + + defmodule Bar do + @moduledoc false + end + end + """ + |> to_source_file + |> run_check(@described_check, ignore_names: []) + |> refute_issues() + end + # # cases raising issues # @@ -70,6 +85,20 @@ defmodule Credo.Check.Readability.ModuleDocTest do |> assert_issue() end + test "it should report modules when @moduledoc is present in submodules only" do + """ + defmodule Foo do + # distinctly no moduledoc here + defmodule Bar do + @moduledoc false + end + end + """ + |> to_source_file + |> run_check(@described_check, ignore_names: []) + |> assert_issue() + end + test "it should report empty strings" do """ defmodule CredoSampleModule do