mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 07:59:15 +02:00
parent
d72170f9a3
commit
4ad6c98d82
@ -71,6 +71,7 @@ Type
|
|||||||
procedure TestIfWithBlock;
|
procedure TestIfWithBlock;
|
||||||
Procedure TestNestedIf;
|
Procedure TestNestedIf;
|
||||||
Procedure TestNestedIfElse;
|
Procedure TestNestedIfElse;
|
||||||
|
Procedure TestNestedIfElseElse;
|
||||||
Procedure TestWhile;
|
Procedure TestWhile;
|
||||||
Procedure TestWhileBlock;
|
Procedure TestWhileBlock;
|
||||||
Procedure TestWhileNested;
|
Procedure TestWhileNested;
|
||||||
@ -714,6 +715,32 @@ begin
|
|||||||
AssertEquals('begin end block',TPasImplBeginBlock,I.ElseBranch.ClassType);
|
AssertEquals('begin end block',TPasImplBeginBlock,I.ElseBranch.ClassType);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestStatementParser.TestNestedIfElseElse;
|
||||||
|
|
||||||
|
// Bug ID 37760
|
||||||
|
|
||||||
|
Var
|
||||||
|
I,I2 : TPasImplIfElse;
|
||||||
|
|
||||||
|
begin
|
||||||
|
DeclareVar('boolean');
|
||||||
|
TestStatement(['if a then',
|
||||||
|
' if b then',
|
||||||
|
' DoA ',
|
||||||
|
' else',
|
||||||
|
' else',
|
||||||
|
' DoB']);
|
||||||
|
I:=AssertStatement('If statement',TPasImplIfElse) as TPasImplIfElse;
|
||||||
|
AssertExpression('IF condition',I.ConditionExpr,pekIdent,'a');
|
||||||
|
AssertNotNull('if branch',I.IfBranch);
|
||||||
|
AssertNotNull('Have else for outer if',I.ElseBranch);
|
||||||
|
AssertEquals('Have if in if branch',TPasImplIfElse,I.ifBranch.ClassType);
|
||||||
|
I2:=I.Ifbranch as TPasImplIfElse;
|
||||||
|
AssertExpression('IF condition',I2.ConditionExpr,pekIdent,'b');
|
||||||
|
AssertNotNull('Have then for inner if',I2.ifBranch);
|
||||||
|
AssertNull('Empty else for inner if',I2.ElseBranch);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestStatementParser.TestWhile;
|
procedure TTestStatementParser.TestWhile;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
|
Loading…
Reference in New Issue
Block a user