digitalmars.D.learn - DMD: how to restore old unittest+main
- novice3 (13/13) Aug 13 2020 Hello.
- Jonathan (7/20) Aug 13 2020 Is there a reason you need to run all unittests every time you
- novice3 (9/11) Aug 13 2020 App will be used by other peoples,
- novice3 (7/9) Aug 13 2020 Starting app with unittests while develop - frequent event for me.
- H. S. Teoh (16/22) Aug 13 2020 During development, this is a valuable time-saver: instead of compiling
- WebFreak001 (4/17) Aug 13 2020 Try
- novice3 (2/5) Aug 13 2020 Thanks! It works as needed.
- Nils Lankila (4/24) Aug 13 2020 Yeah that works but we should really have a way to do this
- novice3 (2/4) Aug 13 2020 Better with compiler switch, may be...
- Steven Schveighoffer (5/31) Aug 13 2020 https://dlang.org/phobos/core_runtime.html#.Runtime.extendedModuleUnitTe...
Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old behaviour (run all unittests then main()) *without use "--DRT-testmode=run-main" switch every time then i start compiled app.exe*? I want just press Enter on app.d file, then press Enter on app.exe. Any advises? Thanks.
Aug 13 2020
On Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote:Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old behaviour (run all unittests then main()) *without use "--DRT-testmode=run-main" switch every time then i start compiled app.exe*? I want just press Enter on app.d file, then press Enter on app.exe. Any advises? Thanks.Is there a reason you need to run all unittests every time you want to run the program? I personally compile with -unittest to make sure all my unittests pass, then recompile without the -unittest flag if I actually want to run the program. This way, time isn't wasted running unittests every time the program is run.
Aug 13 2020
On Thursday, 13 August 2020 at 08:30:44 UTC, Jonathan wrote:Is there a reason you need to run all unittests every time you want to run the program?App will be used by other peoples, and i will release it after developing without unittests. Release is rare action for me. Running while developing is frequent action. I want see is all ok - unittests and main{} - for every test run while develop whithout special efforts from me. Then release with some efforts (compile without "-unittest", with "-release" switch etc).
Aug 13 2020
On Thursday, 13 August 2020 at 08:30:44 UTC, Jonathan wrote:Is there a reason you need to run all unittests every time you want to run the program?Starting app with unittests while develop - frequent event for me. Releasing app - rare event for me. I want do frequent action without efforts (just start and see all ok - unitests and main), and can do rare action (release) with some efforts (compile with other switches).
Aug 13 2020
On Thu, Aug 13, 2020 at 08:30:44AM +0000, Jonathan via Digitalmars-d-learn wrote: [...]Is there a reason you need to run all unittests every time you want to run the program?During development, this is a valuable time-saver: instead of compiling twice, once with -unittest and once without, then running each individually, it helps to have unittests run before main() so that any regressions are immediately noticed, and if unittests pass, then main() runs and manual testing can proceed. Obviously, for release builds unittests are useless, so in that case there's no need to include unittests before running main().I personally compile with -unittest to make sure all my unittests pass, then recompile without the -unittest flag if I actually want to run the program. This way, time isn't wasted running unittests every time the program is run.Lots of time is wasted if you have to compile twice, once with -unittest and once without, while you're in the code-compile-test cycle and need to run main() for manual testing. (Not everything is testable with unittests!) T -- "Holy war is an oxymoron." -- Lazarus Long
Aug 13 2020
On Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote:Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old behaviour (run all unittests then main()) *without use "--DRT-testmode=run-main" switch every time then i start compiled app.exe*? I want just press Enter on app.d file, then press Enter on app.exe. Any advises? Thanks.Try version (unittest) extern(C) __gshared string[] rt_options = [ "testmode=run-main" ];
Aug 13 2020
On Thursday, 13 August 2020 at 08:49:21 UTC, WebFreak001 wrote:Try version (unittest) extern(C) __gshared string[] rt_options = ["testmode=run-main" ];Thanks! It works as needed.
Aug 13 2020
On Thursday, 13 August 2020 at 08:49:21 UTC, WebFreak001 wrote:On Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote:Yeah that works but we should really have a way to do this programmatically, in a way it is already, but by calling function, not by the bias of a string that get parsed.Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old behaviour (run all unittests then main()) *without use "--DRT-testmode=run-main" switch every time then i start compiled app.exe*? I want just press Enter on app.d file, then press Enter on app.exe. Any advises? Thanks.Try version (unittest) extern(C) __gshared string[] rt_options = [ "testmode=run-main" ];
Aug 13 2020
On Thursday, 13 August 2020 at 09:02:28 UTC, Nils Lankila wrote:programmatically, in a way it is already, but by calling functionBetter with compiler switch, may be...
Aug 13 2020
On 8/13/20 5:02 AM, Nils Lankila wrote:On Thursday, 13 August 2020 at 08:49:21 UTC, WebFreak001 wrote:https://dlang.org/phobos/core_runtime.html#.Runtime.extendedModuleUnitTester Though I highly recommend using the rt_options mechanism if all you are after is the original behavior, it's much simpler. -SteveOn Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote:Yeah that works but we should really have a way to do this programmatically, in a way it is already, but by calling function, not by the bias of a string that get parsed.Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old behaviour (run all unittests then main()) *without use "--DRT-testmode=run-main" switch every time then i start compiled app.exe*? I want just press Enter on app.d file, then press Enter on app.exe. Any advises? Thanks.Try version (unittest) extern(C) __gshared string[] rt_options = [ "testmode=run-main" ];
Aug 13 2020