summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2019-08-15 19:28:24 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2019-08-15 19:28:24 +0200
commit40756137278cd5ee2e182e86265c21f0a248808d (patch)
treef067a7067149901a3551b7152b4162d20ac3cad8
parent22f70afe4c15cadd8a58b0a9d505f2d256afd3c0 (diff)
downloadelixir-40756137278cd5ee2e182e86265c21f0a248808d.tar.gz
Improve assertion on function head test
-rw-r--r--lib/elixir/test/elixir/kernel/warning_test.exs24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/elixir/test/elixir/kernel/warning_test.exs b/lib/elixir/test/elixir/kernel/warning_test.exs
index be17b5b9d..c426d1970 100644
--- a/lib/elixir/test/elixir/kernel/warning_test.exs
+++ b/lib/elixir/test/elixir/kernel/warning_test.exs
@@ -695,24 +695,32 @@ defmodule Kernel.WarningTest do
assert capture_err(fn ->
Code.eval_string("""
defmodule Sample1 do
- use Task
+ defmacro __using__(_) do
+ quote do
+ def add(a, b), do: a + b
+ end
+ end
+ end
+
+ defmodule Sample2 do
+ use Sample1
@doc "hello"
- def child_spec(opts)
+ def add(a, b)
end
""")
- end) =~ ""
+ end) == ""
assert capture_err(fn ->
Code.eval_string("""
- defmodule Sample2 do
- def child_spec(spec), do: spec
+ defmodule Sample3 do
+ def add(a, b), do: a + b
@doc "hello"
- def child_spec(opts)
+ def add(a, b)
end
""")
- end) =~ ""
+ end) =~ "function head for def add/2 must come at the top of its direct implementation"
after
- purge([Sample1, Sample2])
+ purge([Sample1, Sample2, Sample3])
end
test "used import via alias" do