www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do I run multiple unittests with rdmd?

reply Anthony <anthoq88 gmail.com> writes:
Hello,

I'm trying to run multiple unittest files with rdmd.
So far I use `find` to just pipe in the files. Eg:


time find source -name *__tests.d -exec rdmd -unittest --main 
-I../libprelude/source -I../libparser/source 
-I../libgeometry/source -Isource {} \;

Is there an easier way to do this?
Mar 04 2021
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, Mar 05, 2021 at 01:47:41AM +0000, Anthony via Digitalmars-d-learn wrote:
 Hello,
 
 I'm trying to run multiple unittest files with rdmd.
 So far I use `find` to just pipe in the files. Eg:
 
 
 time find source -name *__tests.d -exec rdmd -unittest --main
 -I../libprelude/source -I../libparser/source -I../libgeometry/source
 -Isource {} \;
 
 Is there an easier way to do this?
Do you have multiple applications, or a single application spread across multiple sources? In the latter case, you could just use `rdmd -unittest -i -run main.d` (replace `main.d` with whatever source file contains main()) to automatically compile all modules including their unittests *and* run 'em all in one shot. Only in the former case would you need to use your `find` pipeline above. :-) T -- Computers aren't intelligent; they only think they are.
Mar 04 2021
parent Anthony <anthoq88 gmail.com> writes:
On Friday, 5 March 2021 at 02:08:37 UTC, H. S. Teoh wrote:
 In the latter case, you could just use `rdmd -unittest -i -run 
 main.d` (replace `main.d` with whatever source file contains 
 main()) to automatically compile all modules including their 
 unittests *and* run 'em all in one shot.
I didn't know that. Good to know. Thanks
 Only in the former case would you need to use your `find` 
 pipeline above. :-)
I should have mentioned, this is for a library that is used by multiple applications. So I guess the find pipeline is the way to go then.
Mar 04 2021