Skip to content

Commit

Permalink
Replace more incorrect uses of iodata_to_binary
Browse files Browse the repository at this point in the history
This didn't affect the results of any tests since the inputs are limited
to ASCII characters.
  • Loading branch information
fhunleth committed Oct 9, 2022
1 parent 954b8fb commit 0f45e6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/ring_logger_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule RingLoggerTest do
assert_receive {:io, msg}
assert String.contains?(msg, to_string(level))

flattened_message = IO.iodata_to_binary(message)
flattened_message = IO.chardata_to_string(message)
assert String.contains?(msg, flattened_message)
io
end
Expand Down Expand Up @@ -302,7 +302,7 @@ defmodule RingLoggerTest do
:ok =
RingLogger.next(
pager: fn device, msg ->
IO.write(device, "Got #{String.length(IO.iodata_to_binary(msg))} characters")
IO.write(device, "Got #{String.length(IO.chardata_to_string(msg))} characters")
end
)

Expand All @@ -322,7 +322,7 @@ defmodule RingLoggerTest do
:ok =
RingLogger.tail(2,
pager: fn device, msg ->
IO.write(device, "Got #{String.length(IO.iodata_to_binary(msg))} characters")
IO.write(device, "Got #{String.length(IO.chardata_to_string(msg))} characters")
end
)

Expand All @@ -342,7 +342,7 @@ defmodule RingLoggerTest do
:ok =
RingLogger.grep(~r/debug/,
pager: fn device, msg ->
IO.write(device, "Got #{String.length(IO.iodata_to_binary(msg))} characters")
IO.write(device, "Got #{String.length(IO.chardata_to_string(msg))} characters")
end
)

Expand Down
2 changes: 1 addition & 1 deletion test/stress_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule StressTest do
assert_receive {:io, msg}
assert String.contains?(msg, to_string(level))

flattened_message = IO.iodata_to_binary(message)
flattened_message = IO.chardata_to_string(message)
assert String.contains?(msg, flattened_message)
io
end
Expand Down

0 comments on commit 0f45e6c

Please sign in to comment.