www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Unittests on a module

reply DLearner <bmqazwsx123 gmail.com> writes:
If unittest run without a main() being present, crashes on link 
error:
```
lld-link: error: subsystem must be defined
Error: linker exited with status 1
```

Is this intended?

It's not a problem to add temporary
```
void main() {

}
```
to the bottom of the module, but seems wrong as not then testing 
_exactly_ what is to be imported elsewhere.
Jan 13 2023
parent Dennis <dkorpel gmail.com> writes:
On Friday, 13 January 2023 at 19:07:46 UTC, DLearner wrote:
 Is this intended?
It is by design, though opinions differ on whether it's a good design.
 It's not a problem to add temporary
 ```
 void main() {

 }
 ```
 to the bottom of the module,
You can add the `-main` flag to make dmd automatically add such an empty main function when there isn't a `main` already.
Jan 13 2023