Elixir Language
Metaprogramming
खोज…
संकलन समय पर परीक्षण उत्पन्न करें
defmodule ATest do
use ExUnit.Case
[{1, 2, 3}, {10, 20, 40}, {100, 200, 300}]
|> Enum.each(fn {a, b, c} ->
test "#{a} + #{b} = #{c}" do
assert unquote(a) + unquote(b) = unquote(c)
end
end)
end
आउटपुट:
.
1) test 10 + 20 = 40 (Test.Test)
test.exs:6
match (=) failed
code: 10 + 20 = 40
rhs: 40
stacktrace:
test.exs:7
.
Finished in 0.1 seconds (0.1s on load, 0.00s on tests)
3 tests, 1 failure
Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow