Skip to content

Commit 369fd75

Browse files
author
José Valim
committed
Ensure unquotes are respected in the test macro
1 parent c6ff84e commit 369fd75

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/ex_unit/lib/ex_unit/case.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ defmodule ExUnit.Case do
8888
end
8989

9090
def message, [unquote(Macro.escape var)], [], do:
91-
unquote(Macro.escape contents)
91+
unquote(Macro.escape contents, escape_unquote: false)
9292
end
9393
end
9494
end

lib/ex_unit/test/ex_unit/case_template_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ end
3636
defmodule ExUnit.CaseTemplateTest do
3737
use ExUnit.SampleCase, async: true
3838

39+
two = 2
40+
41+
test "unquoting the value #{two}" do
42+
assert 2 == unquote(two)
43+
end
44+
3945
test "receives context from parent case", context do
4046
assert context[:context] == :setup
4147
end

0 commit comments

Comments
 (0)