Macros operate on expressions, not values. That is, they input and output Julia code. So you can’t check the size of e or add e to anything, because e is an expression, not an array. What you can do instead is this:
macro test_macro2(e::Expr)
return esc( :( ones(size($e)[1]) .+ $e) )
end
Then @test_macro2 [a,b,c] will return the expression ones(size([a,b,c][1]) .+ [a,b,c] which is then evaluated outside the macro. Contrast this with
function test_func(a::Array)
return (ones(size(a)[1]) .+ a)
end
Then when you write test_func([a,b,c]), [a,b,c] is evaluated first, and the resulting array is bound to a inside test_func, which uses it to construct a new array.