digitalmars.D.announce - unit-threaded v0.6.3 - now even easier to use / opt-in
- Atila Neves (33/33) Feb 29 2016 http://code.dlang.org/packages/unit-threaded
- Sebastiaan Koppe (3/6) Feb 29 2016 Really nice.
- Dicebot (4/14) Feb 29 2016 Note: only if it has a configuration with an `application` target define...
- Sebastiaan Koppe (4/19) Feb 29 2016 That is pretty darn cool. It means one can write some nice dev
- Sebastiaan Koppe (18/30) Mar 02 2016 Worked nicely, but I had to change some configs.
- Atila Neves (4/23) Mar 02 2016 Yeah, I think that's why. Glad it worked out for you!
http://code.dlang.org/packages/unit-threaded Through the magic of dub, unit-threaded is now easier to include in your project, with no need for a hand-written test main file anymore. And all because the library can be run as an executable by dub. It's an idea that's so obvious in retrospect I don't know how it took me this long. Say you've already got a dub project with unittest blocks and you just want them to have names and be run in threads. Easy, just have a "unittest" configuration in your dub.json/sdl like so: "configurations": [ ..., { "name": "unittest", "preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"], "mainSourceFile": "bin/ut.d", "excludedSourceFiles": "src/main.d", "dependencies": { "unit-threaded": "~>0.6.3" } } Now run "dub test" and enjoy the results. If you want "real" names then add a string UDA to your unittest blocks. And.... that's it. You might not even need to exclude the module with the main function if said function is versioned out for unit test builds. If you want to use the library's other features you'll have to import it but that's easily versioned as well: version(unittest) { import unit_threaded; } Enjoy! Atila
Feb 29 2016
On Monday, 29 February 2016 at 09:37:51 UTC, Atila Neves wrote:http://code.dlang.org/packages/unit-threaded Enjoy! AtilaReally nice. Wow, didn't know dub could build and run a dependency.
Feb 29 2016
On 02/29/2016 02:00 PM, Sebastiaan Koppe wrote:On Monday, 29 February 2016 at 09:37:51 UTC, Atila Neves wrote:Note: only if it has a configuration with an `application` target defined. It is effectively a way to make tools from dub registry usable from other dub projects without messing with system-wide state.http://code.dlang.org/packages/unit-threaded Enjoy! AtilaReally nice. Wow, didn't know dub could build and run a dependency.
Feb 29 2016
On Monday, 29 February 2016 at 12:11:44 UTC, Dicebot wrote:On 02/29/2016 02:00 PM, Sebastiaan Koppe wrote:That is pretty darn cool. It means one can write some nice dev tools. E.g. a file-watcher that runs unittests on each save command.On Monday, 29 February 2016 at 09:37:51 UTC, Atila Neves wrote:Note: only if it has a configuration with an `application` target defined. It is effectively a way to make tools from dub registry usable from other dub projects without messing with system-wide state.http://code.dlang.org/packages/unit-threaded Enjoy! AtilaReally nice. Wow, didn't know dub could build and run a dependency.
Feb 29 2016
On Monday, 29 February 2016 at 09:37:51 UTC, Atila Neves wrote:"configurations": [ ..., { "name": "unittest", "preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"], "mainSourceFile": "bin/ut.d", "excludedSourceFiles": "src/main.d", "dependencies": { "unit-threaded": "~>0.6.3" } }Worked nicely, but I had to change some configs. { "name": "unittest", "preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"], "importPaths": ["bin"], "mainSourceFile": "bin/ut.d", "excludedSourceFiles": ["app.d"], "targetType":"executable", "dependencies": { "unit-threaded": "~>0.6.3" } } probably due to dub's default of the code being in `source/` instead of root folder. Do not know why I had to add `targetType:executable`, perhapse because my project is a library ?
Mar 02 2016
On Wednesday, 2 March 2016 at 12:52:34 UTC, Sebastiaan Koppe wrote:On Monday, 29 February 2016 at 09:37:51 UTC, Atila Neves wrote:Yeah, I think that's why. Glad it worked out for you! Atila[...]Worked nicely, but I had to change some configs. { "name": "unittest", "preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- -f bin/ut.d"], "importPaths": ["bin"], "mainSourceFile": "bin/ut.d", "excludedSourceFiles": ["app.d"], "targetType":"executable", "dependencies": { "unit-threaded": "~>0.6.3" } } probably due to dub's default of the code being in `source/` instead of root folder. Do not know why I had to add `targetType:executable`, perhapse because my project is a library ?
Mar 02 2016