no main in unit tests -

This commit is contained in:
Vadim Lopatin 2017-09-12 13:27:09 +03:00
parent e2116d0be9
commit 54356dbca1
1 changed files with 13 additions and 17 deletions
src/dlangui/platforms/common

View File

@ -1940,35 +1940,31 @@ static if (BACKEND_CONSOLE) {
/// put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app /// put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app
mixin template APP_ENTRY_POINT() { mixin template APP_ENTRY_POINT() {
static if (BACKEND_CONSOLE) { version (unittest) {
int main(string[] args) // no main in unit tests
{
return DLANGUImain(args);
}
} else { } else {
/// workaround for link issue when WinMain is located in library static if (BACKEND_CONSOLE) {
version(Windows) { int main(string[] args)
version (unittest) { {
// no main in unit tests return DLANGUImain(args);
} else { }
} else {
/// workaround for link issue when WinMain is located in library
version(Windows) {
extern (Windows) int WinMain(void* hInstance, void* hPrevInstance, extern (Windows) int WinMain(void* hInstance, void* hPrevInstance,
char* lpCmdLine, int nCmdShow) char* lpCmdLine, int nCmdShow)
{ {
try { try {
int res = DLANGUIWinMain(hInstance, hPrevInstance, int res = DLANGUIWinMain(hInstance, hPrevInstance,
lpCmdLine, nCmdShow); lpCmdLine, nCmdShow);
return res; return res;
} catch (Exception e) { } catch (Exception e) {
Log.e("Exception: ", e); Log.e("Exception: ", e);
return 1; return 1;
} }
} }
}
} else {
version (Android) {
} else { } else {
version (unittest) { version (Android) {
// no main in unit tests
} else { } else {
int main(string[] args) int main(string[] args)
{ {