http://d.puremagic.com/issues/show_bug.cgi?id=10023



--- Comment #4 from Jacob Carlborg <d...@me.com> 2013-06-29 06:11:31 PDT ---
I had an idea how to use this for unit tests. We add a new traits that will
return all the unit test functions of the given module. RMInfo can then be used
to collect all these unit tests functions at compile time. The advantage of
doing it at compile time is because then it's possible to access UDA's attached
to the unit tests. This would basically make it possible to implement named
unit tests in library code:

// UDA
struct name { string name; }

@name("foo") unittest
{
    assert(1 +2 == 3);
}

This is also more flexible then named unit tests implemented in the language.
One could use UDA's to do a more RSpec version of unit tests:

struct describe { string desc; }
struct it { string desc; }

@desctibe("Address.validate")
{
    @it("should validate the address")
    {
        assert(true);
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to