Thread overview
How do I run multiple unittests with rdmd?
Mar 05, 2021
Anthony
Mar 05, 2021
H. S. Teoh
Mar 05, 2021
Anthony
March 05, 2021
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?
March 04, 2021
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.
March 05, 2021
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.