howto run unittest of a single module in dub driven project?

Basile B. b2.temp at gmx.com
Mon Mar 5 09:58:05 UTC 2018


On Monday, 5 March 2018 at 09:19:52 UTC, Arjan wrote:
> On Sunday, 4 March 2018 at 16:51:06 UTC, Basile B. wrote:
>> [1] 
>> https://github.com/BBasile/Coedit/commit/f8c5e686c8c6aaa7dc2c770121767e3e59806a0e
>>
>> Thanks for givin me the idea original poster.
>
> Guess I will have to give coedit another try then.. ;-)
>
> So you do use dub behind the scenes so it seems? Care to 
> elaborate a little on how you achieved this?

No this feature is based on dmd / ldmd or gdmd. It's a kind of 
rdmd.
Basically the current source for the editor which has the focused:

- is auto saved or saved to a temp file if it's a new module
- its shebang is parsed to detect custom options (such as 
"-release" or "-g")
- is optionally scanned to detect if the option "-main" has to be 
passed or not.
- is optionally scanned to detect all "import ...;". The results 
are used to detect what are the deps in a database based on the 
"library manager". From the deps  -I<path> and *.a or *.lib or 
*.d are detected.
- if the option for autodetection is not checked then the whole 
libman is passed as import path, additional source or libs to 
link.
- everything is compiled
- result is run.

The same happens when using the action "run file unittest", just 
-unittest is added to the compiler arguments.

Beside Coedit also support DUB single file package but nothing is 
done by the IDE, just DUB is called and the IDE let him doing his 
job ;)


More information about the Digitalmars-d-learn mailing list