Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can cause the compiler not to produce a console output

I have a DUnit project that won't compile as Console if I add some units.
The Project (dpr) is created by the Wizard and CONSOLE_TESTRUNNER is defined.

{$IFDEF CONSOLE_TESTRUNNER}
{$APPTYPE CONSOLE}
{$ENDIF}

begin
  Application.Initialize;
  if IsConsole then // <-- IsConsole is set to False.
    with TextTestRunner.RunRegisteredTests do
      Free
  else
    GUITestRunner.RunRegisteredTests;
end.

The units that make it fail include some VCL components but no tests are run on them.
I've even tried to set the Linker Option but it made no difference.
Did someone experience a similar issue?
Just for clarification: This project is Win32 in Delphi 2010.

like image 503
Tobias R Avatar asked Apr 02 '12 11:04

Tobias R


1 Answers

That code works just fine for me. I can think of two reasons why Delphi is not producing a console app:

  1. CONSOLE_TESTRUNNER is not defined.
  2. You have {$APPTYPE GUI} somewhere in your project's code.

I'm reasonably confident that item 2 above is the reason for your problem.

like image 68
David Heffernan Avatar answered Oct 13 '22 00:10

David Heffernan