Skip to content

Commit

Permalink
Adds tests for empty ignore files
Browse files Browse the repository at this point in the history
  • Loading branch information
lnenad committed Oct 1, 2024
1 parent 667fa25 commit c849d66
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/dialyxir/formatter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@ defmodule Dialyxir.FormatterTest do
end)
end

test "ignores an empty default ignore file" do
in_project(:ignore_default_empty, fn ->
{:ok, remaining, :no_unused_filters} =
Formatter.format_and_filter([], Project, [], [IgnoreFileStrictFormatter])

assert Project.dialyzer_ignore_warnings() == nil
assert remaining == []
end)
end

test "ignores an empty ignore file specified in mix" do
in_project(:ignore_empty, fn ->
{:ok, remaining, :no_unused_filters} =
Formatter.format_and_filter([], Project, [], [IgnoreFileStrictFormatter])

assert Project.dialyzer_ignore_warnings() == "ignore_empty_test.exs"
assert remaining == []
end)
end


test "does not filter lines not matching the pattern" do

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 24.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 24.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 23.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 24.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.16.3 / OTP 24.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 25.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.17.2 / OTP 26.1

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 23.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 26.1

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.17.2 / OTP 27

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.16.3 / OTP 26.1

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)

Check failure on line 116 in test/dialyxir/formatter_test.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 24.3

test exs ignore does not filter lines not matching the pattern (Dialyxir.FormatterTest)
warning =
{:warn_return_no_exit, {~c"a/different_file.ex", 17},
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions test/fixtures/ignore_default_empty/mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Ignore.Mixfile do

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 26.1

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_default_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)
use Mix.Project

def project do
[
app: :ignore,
version: "0.1.0",
prune_code_paths: false,
dialyzer: [
list_unused_filters: true
]
]
end
end
Empty file.
15 changes: 15 additions & 0 deletions test/fixtures/ignore_empty/mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
defmodule Ignore.Mixfile do

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.14.3 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 25.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.12.3 / OTP 23.3

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.15.7 / OTP 26.1

redefining module Ignore.Mixfile (current version defined in memory)

Check warning on line 1 in test/fixtures/ignore_empty/mix.exs

View workflow job for this annotation

GitHub Actions / Elixir 1.13.4 / OTP 24.3

redefining module Ignore.Mixfile (current version defined in memory)
use Mix.Project

def project do
[
app: :ignore,
version: "0.1.0",
prune_code_paths: false,
dialyzer: [
ignore_warnings: "ignore_empty_test.exs",
list_unused_filters: true
]
]
end
end

0 comments on commit c849d66

Please sign in to comment.