Przeglądaj źródła

* FPCUnit using namespaces

Michaël Van Canneyt 1 rok temu
rodzic
commit
975506af0b

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Decorator.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Decorator;
+{$include ../src/testdecorator.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Registry.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Registry;
+{$include ../src/testregistry.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Report.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Report;
+{$include ../src/fpcunitreport.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Reports.HTML.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Reports.HTML;
+{$include ../src/htmltestreport.pp}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Reports.Plain.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Reports.Plain;
+{$include ../src/plaintestreport.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Runners.Browser.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Runners.Browser;
+{$include ../src/browsertestrunner.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Runners.Console.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Runners.Console;
+{$include ../src/consoletestrunner.pas}

+ 3 - 0
packages/fpcunit/namespaced/FpcUnit.Test.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit FpcUnit.Test;
+{$include ../src/fpcunit.pas}

+ 82 - 0
packages/fpcunit/namespaced/fpcunit_pas2js_namespaced.lpk

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <Package Version="5">
+    <Name Value="fpcunit_pas2js_namespaced"/>
+    <Type Value="RunTimeOnly"/>
+    <AutoUpdate Value="Manually"/>
+    <CompilerOptions>
+      <Version Value="11"/>
+      <SearchPaths>
+        <UnitOutputDirectory Value="js"/>
+      </SearchPaths>
+      <Parsing>
+        <SyntaxOptions>
+          <AllowLabel Value="False"/>
+          <UseAnsiStrings Value="False"/>
+        </SyntaxOptions>
+      </Parsing>
+      <Linking>
+        <Debugging>
+          <GenerateDebugInfo Value="False"/>
+        </Debugging>
+      </Linking>
+      <Other>
+        <CustomOptions Value="-Jc"/>
+        <ExecuteBefore>
+          <Command Value="$MakeExe(IDE,pas2js) -O- fpcunit_pas2js_namespaced.pas"/>
+          <Parsers Count="1">
+            <Item1 Value="Pas2JS"/>
+          </Parsers>
+        </ExecuteBefore>
+      </Other>
+      <SkipCompiler Value="True"/>
+    </CompilerOptions>
+    <Version Major="1"/>
+    <Files Count="8">
+      <Item1>
+        <Filename Value="FpcUnit.Test.pas"/>
+        <UnitName Value="FpcUnit.Test"/>
+      </Item1>
+      <Item2>
+        <Filename Value="FpcUnit.Registry.pas"/>
+        <UnitName Value="FpcUnit.Registry"/>
+      </Item2>
+      <Item3>
+        <Filename Value="FpcUnit.Decorator.pas"/>
+        <UnitName Value="FpcUnit.Decorator"/>
+      </Item3>
+      <Item4>
+        <Filename Value="FpcUnit.Runners.Console.pas"/>
+        <UnitName Value="FpcUnit.Runners.Console"/>
+      </Item4>
+      <Item5>
+        <Filename Value="FpcUnit.Report.pas"/>
+        <UnitName Value="FpcUnit.Report"/>
+      </Item5>
+      <Item6>
+        <Filename Value="FpcUnit.Reports.Plain.pas"/>
+        <UnitName Value="FpcUnit.Reports.Plain"/>
+      </Item6>
+      <Item7>
+        <Filename Value="FpcUnit.Runners.Browser.pas"/>
+        <UnitName Value="FpcUnit.Runners.Browser"/>
+      </Item7>
+      <Item8>
+        <Filename Value="FpcUnit.Reports.HTML.pas"/>
+        <UnitName Value="FpcUnit.Reports.HTML"/>
+      </Item8>
+    </Files>
+    <CompatibilityMode Value="True"/>
+    <RequiredPkgs Count="1">
+      <Item1>
+        <PackageName Value="fcl_base_pas2js_namespaced"/>
+      </Item1>
+    </RequiredPkgs>
+    <UsageOptions>
+      <UnitPath Value="."/>
+    </UsageOptions>
+    <PublishOptions>
+      <Version Value="2"/>
+    </PublishOptions>
+  </Package>
+</CONFIG>

+ 16 - 0
packages/fpcunit/namespaced/fpcunit_pas2js_namespaced.pas

@@ -0,0 +1,16 @@
+{ This file was automatically created by Lazarus. Do not edit!
+  This source is only used to compile and install the package.
+ }
+
+unit fpcunit_pas2js_namespaced;
+
+{$warn 5023 off : no warning about unused units}
+interface
+
+uses
+  FpcUnit.Test, FpcUnit.Registry, FpcUnit.Decorator, FpcUnit.Runners.Console, FpcUnit.Report, FpcUnit.Reports.Plain, 
+  FpcUnit.Runners.Browser, FpcUnit.Reports.HTML;
+
+implementation
+
+end.

+ 6 - 0
packages/fpcunit/browsertestrunner.pas → packages/fpcunit/src/browsertestrunner.pas

@@ -19,14 +19,20 @@
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit BrowserTestRunner;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  Fcl.CustApp, Fcl.App.Browser, System.Classes, System.SysUtils, FpcUnit.Test, FpcUnit.Registry, FpcUnit.Report, FpcUnit.Reports.HTML;
+{$ELSE}
   CustApp, browserapp, Classes, SysUtils,  FPCUnit, TestRegistry,  FPCUnitReport, htmlTestReport;
+{$ENDIF}
 
 const
   Version = '0.9';

+ 19 - 0
packages/fpcunit/consoletestrunner.pas → packages/fpcunit/src/consoletestrunner.pas

@@ -21,13 +21,31 @@
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit ConsoleTestRunner;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  {$IFDEF NODEJS}
+  Fcl.App.NodeJS,
+  {$else}
+  Fcl.App.Browser,
+  {$endif}
+  System.Classes, System.SysUtils,
+  FpcUnit.Test, FpcUnit.Registry, FpcUnit.Decorator,
+  //testutils,
+  FpcUnit.Report,
+  //latextestreport,
+  //xmltestreport,
+  FpcUnit.Reports.Plain
+  //dom
+  ;
+{$ELSE}
   {$IFDEF NODEJS}
   NodeJSApp,
   {$else}
@@ -42,6 +60,7 @@ uses
   PlainTestReport
   //dom
   ;
+{$ENDIF}
 
 const
   Version = '0.3';

+ 0 - 0
packages/fpcunit/fpcunit.css → packages/fpcunit/src/fpcunit.css


+ 6 - 0
packages/fpcunit/fpcunit.pas → packages/fpcunit/src/fpcunit.pas

@@ -13,14 +13,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit FPCUnit;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, JSApi.JS, System.TypInfo;
+{$ELSE}
   Classes, SysUtils, JS, TypInfo;
+{$ENDIF}
 
 type
   EAssertionFailedError = class(Exception);

+ 0 - 0
packages/fpcunit/fpcunit_pas2js.lpk → packages/fpcunit/src/fpcunit_pas2js.lpk


+ 0 - 0
packages/fpcunit/fpcunit_pas2js.pas → packages/fpcunit/src/fpcunit_pas2js.pas


+ 6 - 0
packages/fpcunit/fpcunitreport.pas → packages/fpcunit/src/fpcunitreport.pas

@@ -14,14 +14,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit FPCUnitReport;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, FpcUnit.Test;
+{$ELSE}
   Classes, SysUtils, FPCUnit;
+{$ENDIF}
 
 type
   TWriteTestHeaderEvent = procedure(Sender: TObject; ATest: TTest;

+ 22 - 0
packages/fpcunit/htmltestreport.pp → packages/fpcunit/src/htmltestreport.pp

@@ -1,11 +1,33 @@
+{
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 2006 by Dean Zobec
+
+    Test listener that reports result in the HTML DOM.
+
+    an example of plain text report for FPCUnit tests.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit htmltestreport;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, FpcUnit.Test, FpcUnit.Report, BrowserApi.Web;
+{$ELSE}
   Classes, SysUtils, FPCUnit, FPCUnitReport, web;
+{$ENDIF}
 
 Type
 

+ 6 - 0
packages/fpcunit/plaintestreport.pas → packages/fpcunit/src/plaintestreport.pas

@@ -14,14 +14,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit PlainTestReport;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.Math, System.SysUtils, FpcUnit.Test, FpcUnit.Report;
+{$ELSE}
   Classes, Math, SysUtils, FPCUnit, FPCUnitReport;
+{$ENDIF}
 
 type
   TTestResultOption = (ttoSkipAddress,ttoSkipExceptionMessage,ttoErrorsOnly);

+ 6 - 0
packages/fpcunit/testdecorator.pas → packages/fpcunit/src/testdecorator.pas

@@ -13,14 +13,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit TestDecorator;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.SysUtils, FpcUnit.Test;
+{$ELSE}
   SysUtils, FPCUnit;
+{$ENDIF}
 
 type
 

+ 6 - 0
packages/fpcunit/testregistry.pas → packages/fpcunit/src/testregistry.pas

@@ -13,14 +13,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit TestRegistry;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  FpcUnit.Test, FpcUnit.Decorator;
+{$ELSE}
   FPCUnit, TestDecorator;
+{$ENDIF}
 
 type
   TTestDecoratorClass = class of TTestDecorator;