How to test a DUB-based library during development?

Guillaume Piolat notthat at email.com
Thu Jan 11 12:36:22 UTC 2018


On Thursday, 11 January 2018 at 12:27:27 UTC, DanielG wrote:
> Is there a simple example that shows how to test the library 
> during development, before publishing (ie, before being able to 
> add it as a dependency to another project)?
>
> I guess I'm just asking, what's the convention here? Do I 
> create a separate project and then add my not-yet-published 
> library via 'dub add-local'? Put everything in a unittest in 
> the library itself? etc etc.

You may have some unittest blocks in your source files, and then 
type:

     $ dub test


If you want to add examples, some do it either

A. with a separate dub.json/dub.sdl
    To keep your example up-to-date with master you should use 
path-based dependencies.
    See https://github.com/vibe-d/vibe.d/tree/master/examples for 
examples examples. This is the closest to "standard" you'll get.

    But if the examples are too large and numerous some libraries 
also keep them in another repositery, in such case you will need 
to use tags.

B. with a DUB configuration

C. with a DUB sub-package


IMHO you should rather do A rather than C rather than B.



More information about the Digitalmars-d-learn mailing list