Recent

Author Topic: DUnitX?  (Read 2931 times)

axtens

  • Newbie
  • Posts: 6
DUnitX?
« on: July 13, 2021, 05:36:46 am »
Backstory: I'm a student on Exercism. They have a Delphi track. I was working on the track on my Windows laptop but am now doing my Exercism exercises exclusively in Linux. However, Delphi is not available for Linux. So I asked in the Exercism Slack about using Lazarus/FPC rather than Delphi and was told that there's no DUnitX for Lazarus/FPC and that I should try to get Wine to run Delphi (a prospect that I have grave doubts about.)

Is it that case that there's no DUnitX for Lazarus/FPC. Is there a reason why not? Is it a SMOP or are there other reasons?

-- Bruce

HeavyUser

  • Sr. Member
  • ****
  • Posts: 397
Re: DUnitX?
« Reply #1 on: July 13, 2021, 06:30:21 am »
I have no idea what exactly they need from dunitx but lazarus/fpc come with their own unit testing framework call FPCUnit https://wiki.freepascal.org/fpcunit and there is a port of DUnit2 call fptest https://wiki.freepascal.org/FPTest which might be closer to DUnitX.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • I like bugs.
Re: DUnitX?
« Reply #2 on: July 13, 2021, 08:23:54 am »
Lazarus has an IDE plugin for it called FPCUnitIde.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6381
  • Compiler Developer
Re: DUnitX?
« Reply #3 on: July 13, 2021, 08:50:13 am »
Is it that case that there's no DUnitX for Lazarus/FPC. Is there a reason why not? Is it a SMOP or are there other reasons?

DUnitX relies on language features that are not available in FPC, yet (for example extended RTTI (which is currently Work-in-Progress) or custom attributes (which have initial support in trunk only)).

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: DUnitX?
« Reply #4 on: July 13, 2021, 09:48:59 am »
For my package fpexif I implemented a series of unit tests based on FPCUnit, and I was able to run the same test units also with Delphi, after adapting the project file:

Lazarus-Version:
Code: Pascal  [Select][+][-]
  1. program fpExifTests;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   Interfaces, Forms, GuiTestRunner,
  7.   // here follow the test units
  8.   fetutils,
  9.   fetexifle,
  10.   fetexifbe,
  11.   fetiptc;
  12.  
  13. {$R *.res}
  14.  
  15. begin
  16.   Application.Initialize;
  17.   Application.CreateForm(TGuiTestRunner, TestRunner);
  18.   Application.Run;
  19. end.

Delphi Version:
Code: Pascal  [Select][+][-]
  1. program fpExifTests_Delphi7;
  2.  
  3. uses
  4.   TestFramework,
  5.   Forms,
  6.   GUITestRunner,
  7.   TextTestRunner,
  8.   fpeexifdata in '..\..\fpeexifdata.pas',
  9.   fpeExifReadWrite in '..\..\fpeexifreadwrite.pas',
  10.   fpeGlobal in '..\..\fpeglobal.pas',
  11.   fpeIptcData in '..\..\fpeiptcdata.pas',
  12.   fpeIptcReadWrite in '..\..\fpeiptcreadwrite.pas',
  13.   fpeMakerNote in '..\..\fpemakernote.pas',
  14.   fpeMetadata in '..\..\fpemetadata.pas',
  15.   fpeStrConsts in '..\..\fpestrconsts.pas',
  16.   fpeTags in '..\..\fpetags.pas',
  17.   fpeUtils in '..\..\fpeUtils.pas',
  18.   // Here follow the test units
  19.   fetExifBE in 'common\fetexifbe.pas',
  20.   fetExifLE in 'common\fetexifle.pas',
  21.   fetIptc in 'common\fetiptc.pas',
  22.   fetUtils in 'common\fetutils.pas';
  23.  
  24. {$R *.res}
  25.  
  26. begin
  27.   Application.Initialize;
  28.   GUITestRunner.RunRegisteredTests;
  29. end.

 

TinyPortal © 2005-2018