Skip to content

Commit 39b382a

Browse files
committed
return back to original regex command since parsing result is no longer needed as we sort by calls column
Signed-off-by: Tomasz Marek Sulima <[email protected]>
1 parent 3e93951 commit 39b382a

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

lib/mix/test/mix/tasks/profile.tprof_test.exs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,9 @@ defmodule Mix.Tasks.Profile.TprofTest do
8383

8484
test "sorts based on memory per call", context do
8585
in_tmp(context.test, fn ->
86-
result =
87-
capture_io(fn ->
88-
Tprof.run(["--type", "memory", "--sort", "calls", "-e", @expr])
89-
end)
90-
91-
[_warmup, _profile_results, _columns, _total, first, second, _profile_done, ""] =
92-
String.split(result, ~r/\n+/)
93-
94-
list =
95-
Enum.map([first, second], fn row ->
96-
[mfa, calls, _percent, _words, _per_call] = String.split(row, ~r/\s+/)
97-
{String.to_integer(calls), mfa}
98-
end)
99-
100-
assert list == Enum.sort(list)
101-
assert list == [{1, "Enum.each/2"}, {5, ":erlang.integer_to_binary/1"}]
86+
assert capture_io(fn ->
87+
Tprof.run(["--type", "memory", "--sort", "calls", "-e", @expr])
88+
end) =~ ~r/Enum\.each\/2\s+1\s+.*\n:erlang\.integer_to_binary\/1\s+5\s+/s
10289
end)
10390
end
10491

0 commit comments

Comments
 (0)