Thomas, I have made a function called register_test/3 public, this means
you should be able to mimic the test/3 implementation in your code:

    defmacro property(message, var \\ quote(do: _), contents) do
      contents =
        case contents do
          [do: block] ->
            quote do
              unquote(block)
              :ok
            end
          _ ->
            quote do
              try(unquote(contents))
              :ok
            end
        end

      var      = Macro.escape(var)
      contents = Macro.escape(contents, unquote: true)

      quote bind_quoted: binding do
        property = :"property #{message}"
        ExUnit.Case.register_test(__ENV__, test, [[type: :property]])
        def unquote(property)(unquote(var)), do: unquote(contents)
      end
    end


All of the functions in the code sample above are public API, so you can
rely on them. :) I will look into implementing a sub-counter for the
properties. That will probably be possible if we implement a counter for
assertions. So we would see:

    11 tests (25 assertions)

And in your case:

    11 properties (431 tests)




*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

On Tue, May 17, 2016 at 8:47 AM, Thomas Arts <[email protected]> wrote:

> Thanks to Eric and Valim we now have the possiblity to provide a
> QuickCheck test outcome as:
>
> Finished in 1.4 seconds
> 5 *properties*, 1 failure
>
> Instead of
> Finished in 1.4 seconds
> 5 *tests*, 1 failure
>
> when using properties instead of tests.
> The solution is created by the more general *type* tests can have.
>
> Now, I wonder whether we can also use this on line 260 in ExUnit.Case
>
>   quote bind_quoted: binding do
>       test = :"*test* #{message}"
>       ExUnit.Case.__on_definition__(__ENV__, test, [])
>       def unquote(test)(unquote(var)), do: unquote(contents)
>     end
>
> Here we see a hard-coded "test" in the code (and on some more places as
> well).
> It would be cool to replace it with the type. I checked it quickly and it
> seems to work for arbitrary text,
> but I don't see how I get the tags into this function.
>
> The result would be for failing tests:
>
>   1) *property* Property Instructions schema (InstructionsTest)
>      test/my_web_Instructions_eqc.exs:5
>      forall(json <- MyWeb.Type.Instructions.generate()) do
>        ensure(MyWeb.Type.Instructions.validate(json) == :ok)
>      end
>      Failed for
>
>
> Another fancy thing that I would have preferred over 5 properties is
> 5 properties (511 tests), 1 failure
>
> That is, to get access to the test counter and use the num_tests tag to
> increase the number.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/a07c20da-60d7-4100-bf8b-ba673b0c2e1e%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/a07c20da-60d7-4100-bf8b-ba673b0c2e1e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B7jZZhpYeMsA1uyEqYZ%2BvyzNEHZibxpJ5%2B1bxQ6DA9Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to