On Saturday, 22 June 2019 at 13:51:10 UTC, Paul Backus wrote:
On Friday, 21 June 2019 at 22:35:55 UTC, Mike Brockus wrote:
On Friday, 21 June 2019 at 17:52:43 UTC, Mike Wey wrote:
On 21-06-2019 06:08, Mike Brockus wrote:
[...]

If you are using the D unittests in your source you can recompile the same source with `d_unittest: true`, the appstream-generator project does this: https://github.com/ximion/appstream-generator/blob/master/src/asgen/meson.build#L108

Or you can keep the tests separate and compile these test separately like you are doing in your C project. I use this option in the GlibD project: https://github.com/gtkd-developers/GlibD/blob/master/tests/gobject/meson.build

So to use D 'unittest' I am required to include the main.d module file in the tester executable?

If you pass the `-main` flag to the compiler when building your tester executable, it will add an empty main function for you. For example:

    dmd -unittest -main mymodule.d


I think we made a lot of progress, suddenly it's working and I don't need to include main. Is there a way to indicate based on console output that one executable is the tester and the other is the application?

test_exe = executable('test_exe',
    sources: [ 'test.d' ],
    d_args: [ '-main' ],
    d_unittest: true,
    include_directories: exe_dir)

Reply via email to