summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authormattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-21 17:54:06 +0000
committermattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-11-21 17:54:06 +0000
commit108a4f0d26130aa226b1f0e68577ce5538cfe95d (patch)
tree7548a6c5edf606b49bc183a7a5f966413bcdceac /packages
parentd1a1dbe69cc89d6f4877d460808705c09c740c9a (diff)
downloadfpc-108a4f0d26130aa226b1f0e68577ce5538cfe95d.tar.gz
fcl-passrc: fixed tests TTestProcedureFunction
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47512 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages')
-rw-r--r--packages/fcl-passrc/tests/tcprocfunc.pas68
1 files changed, 37 insertions, 31 deletions
diff --git a/packages/fcl-passrc/tests/tcprocfunc.pas b/packages/fcl-passrc/tests/tcprocfunc.pas
index de5ec0fb34..8f63c7f0cf 100644
--- a/packages/fcl-passrc/tests/tcprocfunc.pas
+++ b/packages/fcl-passrc/tests/tcprocfunc.pas
@@ -1336,23 +1336,25 @@ Var
begin
For t:=otMul to High(TOperatorType) do
+ begin
+ if OperatorTokens[t]='' then continue;
// No way to distinguish between logical/bitwise or/and/Xor
- if not (t in [otBitwiseOr,otBitwiseAnd,otBitwiseXor]) then
- begin
- S:=GetEnumName(TypeInfo(TOperatorType),Ord(T));
- ResetParser;
- if t in UnaryOperators then
- AddDeclaration(Format('operator %s (a: Integer) : te',[OperatorTokens[t]]))
- else
- AddDeclaration(Format('operator %s (a: Integer; b: integer) : te',[OperatorTokens[t]]));
- ParseOperator;
- AssertEquals(S+': Token based ',Not (T in [otInc,otDec,otEnumerator]),FOperator.TokenBased);
- AssertEquals(S+': Correct operator type',T,FOperator.OperatorType);
- if t in UnaryOperators then
- AssertEquals(S+': Correct operator name',format('%s(Integer):te',[OperatorNames[t]]),FOperator.Name)
- else
- AssertEquals(S+': Correct operator name',format('%s(Integer,Integer):te',[OperatorNames[t]]),FOperator.Name);
- end;
+ if t in [otBitWiseOr,otBitwiseAnd,otbitwiseXor] then continue;
+
+ S:=GetEnumName(TypeInfo(TOperatorType),Ord(T));
+ ResetParser;
+ if t in UnaryOperators then
+ AddDeclaration(Format('operator %s (a: Integer) : te',[OperatorTokens[t]]))
+ else
+ AddDeclaration(Format('operator %s (a: Integer; b: integer) : te',[OperatorTokens[t]]));
+ ParseOperator;
+ AssertEquals(S+': Token based ',Not (T in [otInc,otDec,otEnumerator]),FOperator.TokenBased);
+ AssertEquals(S+': Correct operator type',T,FOperator.OperatorType);
+ if t in UnaryOperators then
+ AssertEquals(S+': Correct operator name',format('%s(Integer):te',[OperatorNames[t]]),FOperator.Name)
+ else
+ AssertEquals(S+': Correct operator name',format('%s(Integer,Integer):te',[OperatorNames[t]]),FOperator.Name);
+ end;
end;
procedure TTestProcedureFunction.TestOperatorNames;
@@ -1363,21 +1365,25 @@ Var
begin
For t:=Succ(otUnknown) to High(TOperatorType) do
- begin
- S:=GetEnumName(TypeInfo(TOperatorType),Ord(T));
- ResetParser;
- if t in UnaryOperators then
- AddDeclaration(Format('operator %s (a: Integer) : te',[OperatorNames[t]]))
- else
- AddDeclaration(Format('operator %s (a: Integer; b: integer) : te',[OperatorNames[t]]));
- ParseOperator;
- AssertEquals(S+': Token based',t in [otIn],FOperator.TokenBased);
- AssertEquals(S+': Correct operator type',T,FOperator.OperatorType);
- if t in UnaryOperators then
- AssertEquals('Correct operator name',format('%s(Integer):te',[OperatorNames[t]]),FOperator.Name)
- else
- AssertEquals('Correct operator name',format('%s(Integer,Integer):te',[OperatorNames[t]]),FOperator.Name);
- end;
+ begin
+ if OperatorNames[t]='' then continue;
+ // otInitialize has no result
+ if t=otInitialize then continue;
+ writeln('TTestProcedureFunction.TestOperatorTokens ',t);
+ S:=GetEnumName(TypeInfo(TOperatorType),Ord(T));
+ ResetParser;
+ if t in UnaryOperators then
+ AddDeclaration(Format('operator %s (a: Integer) : te',[OperatorNames[t]]))
+ else
+ AddDeclaration(Format('operator %s (a: Integer; b: integer) : te',[OperatorNames[t]]));
+ ParseOperator;
+ AssertEquals(S+': Token based',t in [otIn],FOperator.TokenBased);
+ AssertEquals(S+': Correct operator type',T,FOperator.OperatorType);
+ if t in UnaryOperators then
+ AssertEquals('Correct operator name',format('%s(Integer):te',[OperatorNames[t]]),FOperator.Name)
+ else
+ AssertEquals('Correct operator name',format('%s(Integer,Integer):te',[OperatorNames[t]]),FOperator.Name);
+ end;
end;
procedure TTestProcedureFunction.TestAssignOperatorAfterObject;