meson unittest

axricard axelrwiko at gmail.com
Tue Jan 7 11:46:46 UTC 2025


On Sunday, 5 January 2025 at 23:52:24 UTC, sfp wrote:
> Anyone have a good way of yanking out all `unittest { ... }` 
> blocks from a library compiled using Meson? It would be nice to 
> approximate what dub does.
>
> Meson has mentions this trick in its help docs 
> (https://mesonbuild.com/D.html#using-embedded-unittests) but it 
> isn't particularly useful. I have a library built from some 
> source files, some of which contain `unittest` functions, and 
> separate executables which link this library in. I might be 
> using it the wrong way, but this trick did nothing useful for 
> me...

What do you mean by 'not particularly useful' ? Unittests are not 
being runned ?

I assume you have something like this in your `lib/meson.build` 
file :

```
mylib_test = executable('mylib_test', <mylib_srcs + fake_main>, 
d_unittest: true)
test('mylib', mylib_test)
```


More information about the Digitalmars-d-learn mailing list