Elixir: Macros hygiene
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Elixir: Macros hygiene
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Your exercise will be checked with these tests:
defmodule Test do
use ExUnit.Case
import ExUnit.CaptureIO
defmodule Exercise do
require Solution
def run_fn(function) do
Solution.with_logging do
function
end
end
end
test "with_logging work" do
assert capture_io(fn -> Exercise.run_fn(fn -> 1 + 5 end) end) ==
"Started execution...\nExecution result is: 6\n"
assert capture_io(fn -> Exercise.run_fn(fn -> %{hello: :world} end) end) ==
"Started execution...\nExecution result is: %{hello: :world}\n"
assert capture_io(fn ->
Exercise.run_fn(fn -> "some string" end)
end) == "Started execution...\nExecution result is: \"some string\"\n"
end
endTeacher's solution will be available in:
20:00
