Skip to content

Commit

Permalink
refactor: removing \r everywhere on refactor case
Browse files Browse the repository at this point in the history
  • Loading branch information
gp-pereira committed Nov 21, 2024
1 parent 9acc9e6 commit 52f7ea4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/support/refactor_case.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Refactorex.RefactorCase do
module = unquote(module)
opts = unquote(opts)

original = unquote(original) |> String.trim()
original = unquote(original) |> String.trim() |> String.replace("\r", "")
expected = unquote(expected) |> String.trim() |> String.replace("\r", "")

range = range_from_markers(original)
Expand All @@ -44,7 +44,7 @@ defmodule Refactorex.RefactorCase do
defmacro assert_not_refactored(module, original, _opts \\ []) do
quote do
module = unquote(module)
original = unquote(original)
original = unquote(original) |> String.trim() |> String.replace("\r", "")

range = range_from_markers(original)
original = remove_markers(original)
Expand Down Expand Up @@ -109,6 +109,7 @@ defmodule Refactorex.RefactorCase do

def remove_markers(text) do
text
|> String.replace("\r", "")
|> String.split("\n")
|> Enum.reject(&String.match?(&1, @marker_regex))
|> Enum.join("\n")
Expand Down

0 comments on commit 52f7ea4

Please sign in to comment.