Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
December 21, 2016 Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
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? |
December 21, 2016 Re: Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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 |
December 01, 2020 Re: Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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
|
December 01, 2020 Re: Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
Posted in reply to 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 ``` |
December 01, 2020 Re: Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | 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?...
|
December 01, 2020 Re: Selective unittesting in DUB | ||||
---|---|---|---|---|
| ||||
Posted in reply to ryuukk_ | 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 |
Copyright © 1999-2021 by the D Language Foundation