Re: Is there a way to disable 'dub test' for applications?
On Monday, 18 April 2016 at 18:19:32 UTC, Jon D wrote: On Monday, 18 April 2016 at 11:47:42 UTC, Dicebot wrote: On Monday, 18 April 2016 at 04:25:25 UTC, Jon D wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a way to set up the dub configuration file to disable running the test? configuration "unittest" { excludedSourceFiles "path/to/main.d" } Very nice, thank you. What also seems to work is: configuration "unittest" { targetType "none" } Then 'dub test' produces the message: Configuration 'unittest' has target type "none". Skipping test. Those two option do different things. My proposal excludes file with `main` function from tested sources but keeps actual test target (so if you have unittest blocks in other modules, those will be checked). Your version completely disabled test target. I wasn't sure which option you want but glad it helped.
Re: Is there a way to disable 'dub test' for applications?
On Monday, 18 April 2016 at 11:47:42 UTC, Dicebot wrote: On Monday, 18 April 2016 at 04:25:25 UTC, Jon D wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a way to set up the dub configuration file to disable running the test? configuration "unittest" { excludedSourceFiles "path/to/main.d" } Very nice, thank you. What also seems to work is: configuration "unittest" { targetType "none" } Then 'dub test' produces the message: Configuration 'unittest' has target type "none". Skipping test.
Re: Is there a way to disable 'dub test' for applications?
On Monday, 18 April 2016 at 04:25:25 UTC, Jon D wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a way to set up the dub configuration file to disable running the test? configuration "unittest" { excludedSourceFiles "path/to/main.d" }
Re: Is there a way to disable 'dub test' for applications?
You can write it in code: version(unittest) static assert(false,"unit tests not supported");
Re: Is there a way to disable 'dub test' for applications?
On Monday, 18 April 2016 at 05:30:21 UTC, Jonathan M Davis wrote: On Monday, April 18, 2016 04:25:25 Jon D via Digitalmars-d-learn wrote: I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a way to set up the dub configuration file to disable running the test? Note: What I'd really like to do is run a custom shell command when 'dub test' is done, I haven't seen anything suggesting that's an option. However, disabling would still be useful. What's the point of even running dub test if you have no unit tests? Just do dub build, and then use the resulting executable, or if you want to build and run in one command, then use dub run. - Jonathan M Davis I should have supplied more context. A few days ago I announced open-sourcing a D package consisting of several executables. Multiple comments recommended making it available via the Dub repository. I wasn't using Dub to build, and there are a number of loose ends when working with Dub and multiple executables. I've been trying to limit the number of issues others might encounter if they pulled the package and ran typical commands, like 'dub test'. It's not a big deal, but if there's an easy way to provide a handler, I will. Also, the reason for a custom shell command is that there are tests, it's just that they are run against the built executable rather than via the unittest framework. --Jon
Re: Is there a way to disable 'dub test' for applications?
On Monday, April 18, 2016 04:25:25 Jon D via Digitalmars-d-learn wrote: > I have an dub config file specifying a targetType of > 'executable'. There is only one file, the file containing main(), > and no unit tests. > > When I run 'dub test', dub builds and runs the executable. This > is not really desirable. Is there a way to set up the dub > configuration file to disable running the test? > > Note: What I'd really like to do is run a custom shell command > when 'dub test' is done, I haven't seen anything suggesting > that's an option. However, disabling would still be useful. What's the point of even running dub test if you have no unit tests? Just do dub build, and then use the resulting executable, or if you want to build and run in one command, then use dub run. - Jonathan M Davis
Is there a way to disable 'dub test' for applications?
I have an dub config file specifying a targetType of 'executable'. There is only one file, the file containing main(), and no unit tests. When I run 'dub test', dub builds and runs the executable. This is not really desirable. Is there a way to set up the dub configuration file to disable running the test? Note: What I'd really like to do is run a custom shell command when 'dub test' is done, I haven't seen anything suggesting that's an option. However, disabling would still be useful. --Jon