DUnitW32.dpr
上传用户:yjb1804
上传日期:2021-01-30
资源大小:3105k
文件大小:3k
源码类别:

Email服务器

开发平台:

Delphi

  1. { $Id: DUnitW32.dpr,v 1.1 2006/07/19 02:55:29 judc Exp $ }
  2. {: DUnit: An XTreme testing framework for Delphi programs.
  3.    @author  The DUnit Group.
  4.    @version $Revision: 1.1 $
  5. }
  6. (*
  7.  * The contents of this file are subject to the Mozilla Public
  8.  * License Version 1.1 (the "License"); you may not use this file
  9.  * except in compliance with the License. You may obtain a copy of
  10.  * the License at http://www.mozilla.org/MPL/
  11.  *
  12.  * Software distributed under the License is distributed on an "AS
  13.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  14.  * implied. See the License for the specific language governing
  15.  * rights and limitations under the License.
  16.  *
  17.  * The Original Code is DUnit.
  18.  *
  19.  * The Initial Developers of the Original Code are Kent Beck, Erich Gamma,
  20.  * and Juancarlo A馿z.
  21.  * Portions created The Initial Developers are Copyright (C) 1999-2000.
  22.  * Portions created by The DUnit Group are Copyright (C) 2000-2003.
  23.  * All rights reserved.
  24.  *
  25.  * Contributor(s):
  26.  * Kent Beck <kentbeck@csi.com>
  27.  * Erich Gamma <Erich_Gamma@oti.com>
  28.  * Juanco A馿z <juanco@users.sourceforge.net>
  29.  * Chris Morris <chrismo@users.sourceforge.net>
  30.  * Jeff Moore <JeffMoore@users.sourceforge.net>
  31.  * Uberto Barbini <uberto@usa.net>
  32.  * Kris Golko <neuromancer@users.sourceforge.net>
  33.  * The DUnit group at SourceForge <http://dunit.sourceforge.net>
  34.  *
  35.  *)
  36. program DUnitW32;
  37. uses
  38. {$IFDEF FASTMM}
  39.   {$IFNDEF VER180}
  40.     {$IFNDEF CLR}
  41.       FastMM4,
  42.     {$ENDIF}
  43.   {$ENDIF}
  44. {$ELSE}
  45.     ShareMem,
  46. {$ENDIF}
  47.   Windows,
  48.   SysUtils,
  49.   Forms,
  50.   Dialogs,
  51.   GUITestRunner in 'GUITestRunner.pas' {GUITestRunner},
  52.   TestFramework in 'TestFramework.pas',
  53.   TextTestRunner in 'TextTestRunner.pas',
  54.   DUnitMainForm in 'DUnitMainForm.pas',
  55.   DUnitAbout in 'DUnitAbout.pas' {DUnitAboutBox},
  56.   TestModules in 'TestModules.pas',
  57.   TestExtensions in 'TestExtensions.pas';
  58. {$R *.RES}
  59. {$R versioninfo.res }
  60. const
  61.   rcs_id :string = '#(@)$Id: DUnitW32.dpr,v 1.1 2006/07/19 02:55:29 judc Exp $';
  62.   SwitchChars = ['-','/'];
  63. procedure RunInConsoleMode;
  64. var
  65.   i :Integer;
  66. begin
  67.   try
  68.     if not IsConsole then
  69.       Windows.AllocConsole;
  70.     for i := 1 to ParamCount do
  71.     begin
  72.       if not (ParamStr(i)[1] in SwitchChars) then
  73.          RegisterModuleTests(ParamStr(i));
  74.     end;
  75.     TextTestRunner.RunRegisteredTests(rxbHaltOnFailures);
  76.   except
  77.     on e:Exception do
  78.       Writeln(Format('%s: %s', [e.ClassName, e.Message]));
  79.   end;
  80. end;
  81. begin
  82.   if FindCmdLineSwitch('c', SwitchChars, true) then
  83.     RunInConsoleMode
  84.   else
  85.   begin
  86.     Application.Initialize;
  87.     Application.Title := 'DUnit - An Extreme Testing Framework';
  88.     if not SysUtils.FindCmdLineSwitch('nologo', ['/','-'], true) then
  89.       DUnitAbout.Splash;
  90.     Application.CreateForm(TDUnitForm, DUnitForm);
  91.     try
  92.       Application.Run;
  93.     except
  94.        on e:Exception do
  95.          ShowMessage(e.Message);
  96.     end;
  97.   end;
  98. end.