fcl-passrc: test helper for double

This commit is contained in:
mattias 2019-03-06 18:11:20 +00:00
parent 3bc17fa205
commit 1e56a381ec
2 changed files with 29 additions and 2 deletions

View File

@ -2735,9 +2735,9 @@ begin
FCurSourceFile := FileResolver.FindSourceFile(AFilename);
FCurFilename := AFilename;
AddFile(FCurFilename);
{$IFDEF HASFS}
{$IFDEF HASFS}
FileResolver.BaseDirectory := IncludeTrailingPathDelimiter(ExtractFilePath(FCurFilename));
{$ENDIF}
{$ENDIF}
if LogEvent(sleFile) then
DoLog(mtInfo,nLogOpeningFile,SLogOpeningFile,[FormatPath(AFileName)],True);
end;

View File

@ -927,6 +927,7 @@ type
Procedure TestTypeHelper_String;
Procedure TestTypeHelper_Boolean;
Procedure TestTypeHelper_Double;
Procedure TestTypeHelper_DoubleAlias;
Procedure TestTypeHelper_Constructor_NewInstance;
Procedure TestTypeHelper_InterfaceFail;
@ -17347,6 +17348,32 @@ begin
end;
procedure TTestResolver.TestTypeHelper_Double;
begin
StartProgram(false);
Add([
'{$modeswitch typehelpers}',
'type',
' Float = double;',
' THelper = type helper for float',
' const NPI = 3.141592;',
' function ToStr: String;',
' end;',
'function THelper.ToStr: String;',
'begin',
'end;',
'var',
' a,b: Float;',
' s: string;',
'begin',
' s:=(a * b.NPI).ToStr;',
' s:=(a * float.NPI).ToStr;',
' s:=float.NPI.ToStr;',
' s:=3.2.ToStr;',
'']);
ParseProgram;
end;
procedure TTestResolver.TestTypeHelper_DoubleAlias;
begin
StartProgram(false);
Add([