mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-06 10:37:49 +02:00
fcl-passrc: test helper for double
This commit is contained in:
parent
3bc17fa205
commit
1e56a381ec
@ -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;
|
||||
|
@ -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([
|
||||
|
Loading…
Reference in New Issue
Block a user