digitalmars.D - Enumerating unittests
- Shachar Shemesh (4/4) Nov 17 2017 Hi all,
- Michael V. Franklin (4/6) Nov 17 2017 Try this: https://dlang.org/spec/traits.html#getUnitTests
- Atila Neves (5/11) Nov 17 2017 Note that before dmd 2.077.0 that trait only works when compiling
- Shachar Shemesh (8/16) Nov 17 2017 This is precisely what I asked for, but not what I need :-\
- Atila Neves (18/37) Nov 18 2017 No, you're not.
Hi all, Is there a way to enumerate all the unittests in a specific module? Thanks, Shachar
Nov 17 2017
On Friday, 17 November 2017 at 08:12:13 UTC, Shachar Shemesh wrote:Is there a way to enumerate all the unittests in a specific module?Try this: https://dlang.org/spec/traits.html#getUnitTests Mike
Nov 17 2017
On Friday, 17 November 2017 at 08:32:23 UTC, Michael V. Franklin wrote:On Friday, 17 November 2017 at 08:12:13 UTC, Shachar Shemesh wrote:Note that before dmd 2.077.0 that trait only works when compiling all-at-once. AtilaIs there a way to enumerate all the unittests in a specific module?Try this: https://dlang.org/spec/traits.html#getUnitTests Mike
Nov 17 2017
On 17/11/17 10:32, Michael V. Franklin wrote:On Friday, 17 November 2017 at 08:12:13 UTC, Shachar Shemesh wrote:This is precisely what I asked for, but not what I need :-\ The problem is that it needs a module name to enumerate. I'm not aware of a way to enumerate all modules at compile time. Essentially, I can enumerate all modules at run time, but to get the list of unittests in them, I need to know them at compile time. Am I missing something? ShacharIs there a way to enumerate all the unittests in a specific module?Try this: https://dlang.org/spec/traits.html#getUnitTests Mike
Nov 17 2017
On Saturday, 18 November 2017 at 07:35:11 UTC, Shachar Shemesh wrote:On 17/11/17 10:32, Michael V. Franklin wrote:No, you're not. Unfortunately this is how compile-time reflection works in D: at the module level (or lower). If you want to reflect on all modules in a project, then the build system has to generate the file that does the reflection for you. There is currently no way to reflect on a package. This is why unit-threaded has a dub configuration to generate the file that drives the reflection, by looking at the file system and writing out something that looks like this: import unit_threaded; int main(string[] args) { return args.runTests!("module1", "module2", ...); } You'd have to do something similar. Alternatively, just use unit-threaded. ;) AtilaOn Friday, 17 November 2017 at 08:12:13 UTC, Shachar Shemesh wrote:This is precisely what I asked for, but not what I need :-\ The problem is that it needs a module name to enumerate. I'm not aware of a way to enumerate all modules at compile time. Essentially, I can enumerate all modules at run time, but to get the list of unittests in them, I need to know them at compile time. Am I missing something? ShacharIs there a way to enumerate all the unittests in a specific module?Try this: https://dlang.org/spec/traits.html#getUnitTests Mike
Nov 18 2017