Extract prefix constant for koans

This commit is contained in:
Uku Taht
2015-12-17 01:57:49 +00:00
parent 34cb474569
commit 5dec471422
3 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
defmodule Koans do
@prefix "koan: "
defmacro koan(name, body) do
compiled_name = :"koan: #{name}"
compiled_name = :"#{prefix}#{name}"
quote do
def unquote(compiled_name)() do
try do
@@ -19,4 +21,8 @@ defmodule Koans do
import ExUnit.Assertions
end
end
def prefix do
@prefix
end
end