www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Selective unittesting in DUB

reply =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Is there a way to specify in dub.json (or any other file) that 
only a subset of the sources compiled and linked to a library or 
app should have they're unittests enabled?
Dec 21 2016
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2016-12-21 19:07, Nordlöw wrote:
 Is there a way to specify in dub.json (or any other file) that only a
 subset of the sources compiled and linked to a library or app should
 have they're unittests enabled?
You can use the "unittest" configuration in Dub to add or remove files, but I don't think you can disable some of the unittest blocks in a single module. There's also unit-threaded [1] which allows you to run specific unit tests. [1] https://github.com/atilaneves/unit-threaded -- /Jacob Carlborg
Dec 21 2016
parent reply ryuukk_ <ryuukk_ gmail.com> writes:
On Wednesday, 21 December 2016 at 19:49:20 UTC, Jacob Carlborg 
wrote:
 On 2016-12-21 19:07, Nordlöw wrote:
 Is there a way to specify in dub.json (or any other file) that 
 only a
 subset of the sources compiled and linked to a library or app 
 should
 have they're unittests enabled?
You can use the "unittest" configuration in Dub to add or remove files, but I don't think you can disable some of the unittest blocks in a single module. There's also unit-threaded [1] which allows you to run specific unit tests. [1] https://github.com/atilaneves/unit-threaded
I was looking for an answser to that question I am sorry but this should be supported out of the box Nobody should have to download ton of dependencies to make such basic and needed feature to work... i should be able to do: dub test src/module.d ... this is very disappointing
Nov 30 2020
parent reply ryuukk_ <ryuukk_ gmail.com> writes:
Running .\dawn-test-application.exe
2 modules passed unittests


Wich ones????? it should print


```
Running tests for target X

------------- src/module_a.d Tests: OK   <-- line in green
------------- src/module_b.d Tests: OK
------------- src/module_c.d Tests: OK
------------- src/module_e.d Tests: FAIL <-- line in red

3 modules passed, 1 failed

```
Nov 30 2020
parent Johannes Loher <johannes.loher fg4f.de> writes:
Am 01.12.20 um 08:11 schrieb ryuukk_:
 Running .\dawn-test-application.exe
 2 modules passed unittests
 
 
 Wich ones????? it should print
 
 
 ```
 Running tests for target X
 
 ------------- src/module_a.d Tests: OK   <-- line in green
 ------------- src/module_b.d Tests: OK
 ------------- src/module_c.d Tests: OK
 ------------- src/module_e.d Tests: FAIL <-- line in red
 
 3 modules passed, 1 failed
 
 ```
 
 
From what I understand, the default test runner is intentionally being kept quite simple. There are some libraries that provide test runners that do what you expect (e.g. [1], [2], [3], there is probably more). [1] https://code.dlang.org/packages/silly [2] https://code.dlang.org/packages/unit-threaded [3] https://code.dlang.org/packages/trial
Dec 01 2020
prev sibling parent =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
On Wednesday, 21 December 2016 at 18:07:23 UTC, Nordlöw wrote:
 Is there a way to specify in dub.json (or any other file) that 
 only a subset of the sources compiled and linked to a library 
 or app should have they're unittests enabled?
Check this one: app.d ------ Version ( DoubleBuffer ) { unittest { // ... } } else { unittest { // ... } } or unittest { Version ( DoubleBuffer ) { // ... } // ... } dub.json -------- { ..., "buildTypes": { "debug": { "versions": [ "DoubleBuffer" ] } } } Or may be "pragma" can help you... version ( Windows ) { pragma( lib, "gdi32.lib" ); } How to specify "DoubleBuffer" via dub's command line?...
Nov 30 2020