basho/rebar — pull request #250 by ostinelli (2012-06-17 17:59:39+00:00)
Title: Add 'generator' option to eunit to run a single generator

Eunit allows to specify individual test generators to run, instead of _all_ the tests or a _specific suite_ ([Ref](http://www.erlang.org/doc/apps/eunit/chapter.html#Primitives)). This is very useful when you are working on a single test and don't necessarily want to run all tests every time you are writing one.

You can for instance run just the single test `myapp_mymod_tests:myfunc_test_/0` by running:
```erlang
eunit:test({generator, myapp_mymod_tests, myfunc_test_}).
```

This patch allows to specify a single generator test like this:

```bash
rebar eunit generator=myapp_mymod_tests:myfunc_test_
```

Output of `make check`:

```bash
$ make check
[...]
Command 'debug' not understood or not applicable
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
==> rebar (xref)
make: [dialyzer_warnings] Error 2 (ignored)
```

Three new tests added, partial output of `rebar eunit -v`:

```bash
Ensure EUnit runs with tests in a 'test' dir and a defined generator
rebar_eunit_tests:68: eunit_with_generator_test_ (Specific module is found and run)...ok
rebar_eunit_tests:71: eunit_with_generator_test_ (Specific test is found and run)...ok
rebar_eunit_tests:74: eunit_with_generator_test_ (Single test is run)...ok
```