specd - write more expressive unit tests

jostly johan.f.ostling at gmail.com
Wed Sep 4 10:38:11 PDT 2013


On Tuesday, 3 September 2013 at 06:36:20 UTC, Jacob Carlborg 
wrote:
> On 2013-09-02 21:03, jostly wrote:
>> specd is a DSL library allowing you to write more expressive 
>> unit tests.
>> It is inspired by projects like specs2 and ScalaTest from the 
>> Scala world.
>>
>> Example:
>>
>>     unittest {
>>         describe("a string")
>>             .should("have a length property", 
>> "foo".length.must.equal(3));
>>     }
>>
>> Features:
>> * DSL for expressing unit tests as specifications
>> * Verify with "must" instead of assert
>> * Report successful / failed tests using green / red paradigm
>>
>> Available as a dub dependency ("specd") or from
>> https://github.com/jostly/specd
>>
>> Comments and suggestions for improvement are welcome!
>
> I've been working on something similar myself.
>
> https://github.com/jacob-carlborg/dspec

Narrowly avoided nameclash there. :) Good to see others thinking 
along the same lines.

> I'm working on a new syntax using UDA's, shown here:
>
> https://github.com/jacob-carlborg/phobos/blob/serialization/std/serialization/tests/array.d

Looks interesting. I hadn't heard of the UDA's before, they seem 
quite powerful from a brief glance.


More information about the Digitalmars-d-announce mailing list