meson unittest
sfp
sfp at hush.ai
Tue Jan 7 17:55:50 UTC 2025
On Tuesday, 7 January 2025 at 11:46:46 UTC, axricard wrote:
> [...[
>
> What do you mean by 'not particularly useful' ? Unittests are
> not being runned ?
>
> [...]
I dug into this a bit more and figured out what the problem was.
File `blah.d`:
```
void f() {
import std.stdio;
writeln("hi");
}
unittest {
writeln("bye");
}
```
File `main.d`:
```
import blah;
void main() {
f();
}
```
File `meson.build`:
```
project('unittest', 'd')
mainlib = library('mainlib', ['blah.d'])
executable('maintest', ['main.d'], link_with: [mainlib],
d_unittest: true)
```
Run:
```
$ meson setup builddir
$ cd builddir
$ meson compile
$ ./maintest
```
Outputs "hi" only.
Change `meson.build` to:
```
project('unittest', 'd')
mainlib = library('mainlib', ['blah.d'], d_unittest: true)
executable('maintest', ['main.d'], link_with: [mainlib])
```
Tests run, but `maintest` does not. You can add `d_unittest:
true` to the `executable` invocation or not---doesn't make a
difference.
Pretty unclear from the Meson docs what the expected behavior
should be.
More information about the Digitalmars-d-learn
mailing list