Skip to content

Commit

Permalink
Fix tests for Elixir versions < 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Apr 5, 2021
1 parent 30fab35 commit 01578e4
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions test/credo/check/consistency/space_around_operators_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ defmodule Credo.Check.Consistency.SpaceAroundOperatorsTest do
for prio < -999..0 do
# something
end
for prio < 1..10//2 do
# something
end
for prio < 10..1//-2 do
# something
end
end
"""
@with_spaces5 """
Expand Down Expand Up @@ -270,6 +262,33 @@ defmodule Credo.Check.Consistency.SpaceAroundOperatorsTest do
|> refute_issues()
end

if(Version.match?(System.version(), ">= 1.12.0-rc")) do
# Elixir >= 1.12.0
#
test "it should not report issues if spaces are used everywhere /2" do
[
@with_spaces,
@with_spaces2,
@with_spaces3,
@with_spaces4,
"""
defmodule OtherModule3_0 do
for prio < 1..10//2 do
# something
end
for prio < 10..1//-2 do
# something
end
end
"""
]
|> to_source_files()
|> run_check(@described_check)
|> refute_issues()
end
end

test "it should not report issues if spaces are used everywhere in a single file" do
[
@with_spaces5
Expand Down

0 comments on commit 01578e4

Please sign in to comment.