Recent

Author Topic: What is the current state of mocking in Free Pascal  (Read 1650 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1113
  • Professional amateur ;-P
What is the current state of mocking in Free Pascal
« on: May 03, 2022, 02:28:04 pm »
Hi Y'all,

As of late I've been trying to up my game in testing.
This means that you come to a point that you need to use Dependency Injection based Mocking in your code in order to have the least coupling of your classes.

From a, not so deep, Google search I found these two projects for Mocking in Object Pascal:
  • Delphi Mocks - Maintained and active but for Delphi
  • Pascal Mock - Does not seem to be any activity past 2007 (Code is still in CVS)

Is this still the status quo of mocking libraries for Free Pascal?

Because I don't think that the Delphi one will work and I can't comment on the Pascal Mock one since I haven't tried it yet.

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: What is the current state of mocking in Free Pascal
« Reply #1 on: May 04, 2022, 09:31:33 am »
From a, not so deep, Google search I found these two projects for Mocking in Object Pascal:
  • Delphi Mocks - Maintained and active but for Delphi
  • Pascal Mock - Does not seem to be any activity past 2007 (Code is still in CVS)

Is this still the status quo of mocking libraries for Free Pascal?

I'm not really aware of anything else and currently your best bet is probably still the Pascal Mock (despite it being not maintained anymore, but if it works there isn't much maintainence needed) as the RTTI functionality is not yet capable of implementing something like Delphi Mocks. This will likely change once the Extended RTTI is implemented, but even then this would only be available with the next release version (probably 3.4).

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1113
  • Professional amateur ;-P
Re: What is the current state of mocking in Free Pascal
« Reply #2 on: May 05, 2022, 02:31:43 am »
Hey PascalDragon,

I'm not really aware of anything else and currently your best bet is probably still the Pascal Mock (despite it being not maintained any more, but if it works there isn't much maintenance needed) as the RTTI functionality is not yet capable of implementing something like Delphi Mocks. This will likely change once the Extended RTTI is implemented, but even then this would only be available with the next release version (probably 3.4).

Thanks mate, really appreciate the info you provide !!

Okies, so then, I'll have to get my head around Pascal Mock. Many thanks !!!

BTW, I'm pretty bad at connecting future versions with linear time, so what's your best bet for 3.4?

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: What is the current state of mocking in Free Pascal
« Reply #3 on: May 05, 2022, 09:00:42 am »
BTW, I'm pretty bad at connecting future versions with linear time, so what's your best bet for 3.4?

This decade. :P

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1113
  • Professional amateur ;-P
Re: What is the current state of mocking in Free Pascal
« Reply #4 on: May 05, 2022, 06:13:38 pm »
Hey PascalFragon,

BTW, I'm pretty bad at connecting future versions with linear time, so what's your best bet for 3.4?

This decade. :P

ROTFL !!! 🤣 Fair enough, I did walk into that one with eyes wide open, LOL!!

Thanks mate for the sincere chuckle :D !!

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Ten_Mile_Hike

  • New Member
  • *
  • Posts: 44
Re: What is the current state of mocking in Free Pascal
« Reply #5 on: August 01, 2022, 01:12:12 am »
From all the posts that I've read I would say that the OP gets mocked about 10% of the time.  :D  :D  :D

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1113
  • Professional amateur ;-P
Re: What is the current state of mocking in Free Pascal
« Reply #6 on: August 02, 2022, 09:59:22 pm »
Hey Ten_Mile_Hike,

From all the posts that I've read I would say that the OP gets mocked about 10% of the time.  :D  :D  :D

ROTFL!!!!

I wish the forum had the same thing as Discord where I could put one of these 🤣 as a reaction to your post!!!
🤣 🤣 🤣 🤣

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018