Macro to generate function with body containing an arg and var bound in outer scope?

As you can see in the code, they are unquoteing contents (your body) first before escapeing it. Also they escape using the unquote: true option.

Perhaps you should evaluate those ways?

https://github.com/elixir-lang/elixir/blob/v1.5.2/lib/ex_unit/lib/ex_unit/case.ex#L258-L280