fptest via svn update and the output at cmd level had too many ? symbols for my taste.) Is anyone using unit-test source code that they share easily between Delphi DX10 and FPC 3.0.0 ? Console output or GUI ? I need something that can show unicode output without distortion because I need to test string content carefully.
I don't fully understand what you mean. What ? symbols? For unit info and line number information (backtrace), or for failed test output?
If the latter, I don't see the need in using Unicode text in failed test messages either. eg: I write my unit tests as follows:
procedure TTestTIUtils.tiIntlDateStorAsDateTime;
var
dt: TDateTime;
begin
dt := EncodeDate(2006, 1, 18) + EncodeTime(15, 19, 22, 0);
CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('20060118T151922'), 'Failed on 1');
dt := EncodeDate(2006, 1, 18);
CheckEquals(dt, tiUtils.tiIntlDateStorAsDateTime('20060118T000000'), 'Failed on 2');
dt := 0;
CheckEquals(dt, tiUtils.tiIntlDateStorAsDateTime('00000000T000000'), 'Failed on 3');
dt := EncodeTime(9, 10, 41, 22);
CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('00000000T091041'), 'Failed on 4');
dt := EncodeDate(1652, 6, 15) + EncodeTime(12, 34, 56, 12);
CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('16520615T123456'), 'Failed on 5');
end;
Note that I always use error messages in the format
"Failed on xxx", meaning if I get a failed report that says "TTestTIUtils.tiIntlDateStorAsDateTime failed on 5", I immediately know where to look in the unit tests, and know exactly what test failed. In this case, I never need to bother with unicode output.
Can you give an example of a test case where you have ? symbol (assuming Unicode) issues?
Saying all that, FPC 3.0 has just been release - I haven't had the time to test FPTest thoroughly with FPC 3.0 yet. But I would imaging that the RTL's TextCompare(), SameText() etc should handle Unicode text comparisons correctly. If not, that is likely an issue with FPC, not FPTest. FPTest uses the generic String data type, I still need to investigate how that translates in FPC 3.0
As for unit testing frameworks and compatibility with Delphi. In that case, use DUnit2 for Delphi and FPTest for FPC. The FPTest code is a fork of DUnit2, and both frameworks are used successfully in tiOPF's test suite - which is Delphi and FPC compatible.