Finally - FINALLY - unit tests in #FreePascal make sense. As usual, it was a few tiny details that I couldn't quite grasp. Someone (@jbmorley) very kindly took the time to walk me though, and now I'm all set to test and refactor #CTRAN!
FYI: I'm using FPTest, which has a much nicer CLI output that FPCUnit.
=> More informations about this toot | More toots from thelastpsion@oldbytes.space
Next thing I need to look up - inheritance. Specifically, creating a wrapper class to test private methods in a parent class.
=> More informations about this toot | More toots from thelastpsion@oldbytes.space
Well, it was surprisingly easy. Here, I'm re-declaring a strict protected method as private:
TPsionOOParserWrap = class(TPsionOOParser)
private
procedure _AddToken(toktype: TTokenType; tokliteral: String);
end;
{ snip }
procedure TPsionOOParserWrap._AddToken(toktype: TTokenType; tokliteral: String);
begin
Inherited;
end;
If someone with more knowledge of #ObjectPascal than me thinks that this is unnecessary, or there's a better way to do it, then please let me know!
[#]Pascal #FreePascal
=> More informations about this toot | More toots from thelastpsion@oldbytes.space This content has been proxied by September (3851b).Proxy Information
text/gemini