Skip to content

Commit

Permalink
Rename test helper for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
camelpunch committed Nov 10, 2024
1 parent 91013e6 commit 2c1a5da
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions test/drawing_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ defmodule Mudbrick.DrawingTest do
use ExUnit.Case, async: true
use ExUnitProperties

import Mudbrick.TestHelper,
only: [
invalid_colour: 0,
output: 2
]

alias Mudbrick.Path

alias Mudbrick.Path.{
Expand All @@ -17,6 +11,13 @@ defmodule Mudbrick.DrawingTest do
Rectangle
}

alias Mudbrick.TestHelper

import Mudbrick.TestHelper,
only: [
invalid_colour: 0
]

test "can add drawings to a page" do
import Mudbrick

Expand Down Expand Up @@ -175,7 +176,7 @@ defmodule Mudbrick.DrawingTest do
end

defp operations(f) do
output(fn _ -> f.() end, Mudbrick.Path.Output)
TestHelper.wrapped_output(fn _ -> f.() end, Mudbrick.Path.Output)
|> Enum.map(&Mudbrick.TestHelper.show/1)
|> Enum.reverse()
end
Expand Down
4 changes: 2 additions & 2 deletions test/mudbrick/text_block_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Mudbrick.TextBlockTest do
use ExUnit.Case, async: true

import Mudbrick.TestHelper, only: [output: 2, bodoni_regular: 0]
import Mudbrick.TestHelper, only: [bodoni_regular: 0]

alias Mudbrick.Font
alias Mudbrick.TextBlock
Expand Down Expand Up @@ -451,7 +451,7 @@ defmodule Mudbrick.TextBlockTest do
end

defp output(f) do
output(f, Mudbrick.TextBlock.Output) |> Enum.reverse()
Mudbrick.TestHelper.wrapped_output(f, TextBlock.Output) |> Enum.reverse()
end

defp operations(ops) do
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule Mudbrick.TestHelper do
@example_png
end

def output(f, output_mod) when is_function(f) do
def wrapped_output(f, output_mod) when is_function(f) do
import Mudbrick

{doc, _contents_obj} =
Expand Down

0 comments on commit 2c1a5da

Please sign in to comment.