mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 01:26:03 +02:00
* Additional test for 37760
git-svn-id: trunk@47017 -
This commit is contained in:
parent
4ad6c98d82
commit
2fc63a4f17
@ -72,6 +72,7 @@ Type
|
||||
Procedure TestNestedIf;
|
||||
Procedure TestNestedIfElse;
|
||||
Procedure TestNestedIfElseElse;
|
||||
procedure TestIfIfElseElseBlock;
|
||||
Procedure TestWhile;
|
||||
Procedure TestWhileBlock;
|
||||
Procedure TestWhileNested;
|
||||
@ -741,6 +742,30 @@ begin
|
||||
AssertNull('Empty else for inner if',I2.ElseBranch);
|
||||
end;
|
||||
|
||||
procedure TTestStatementParser.TestIfIfElseElseBlock;
|
||||
|
||||
var
|
||||
OuterIf,InnerIf: TPasImplIfElse;
|
||||
begin
|
||||
DeclareVar('boolean');
|
||||
DeclareVar('boolean','B');
|
||||
TestStatement(['if a then','if b then',' begin',' end','else','else',' begin',' end']);
|
||||
OuterIf:=AssertStatement('If statement',TPasImplIfElse) as TPasImplIfElse;
|
||||
AssertExpression('IF condition',OuterIf.ConditionExpr,pekIdent,'a');
|
||||
AssertNotNull('if branch',OuterIf.IfBranch);
|
||||
AssertEquals('if else block',TPasImplIfElse,OuterIf.ifBranch.ClassType);
|
||||
InnerIf:=OuterIf.IfBranch as TPasImplIfElse;
|
||||
AssertExpression('IF condition',InnerIf.ConditionExpr,pekIdent,'b');
|
||||
AssertNotNull('if branch',InnerIf.IfBranch);
|
||||
AssertEquals('begin end block',TPasImplBeginBlock,InnerIf.ifBranch.ClassType);
|
||||
AssertNotNull('Else branch',InnerIf.ElseBranch);
|
||||
AssertEquals('empty statement',TPasImplCommand,InnerIf.ElseBranch.ClassType);
|
||||
AssertEquals('empty command','',TPasImplCommand(InnerIf.ElseBranch).Command);
|
||||
AssertNotNull('Else branch',OuterIf.ElseBranch);
|
||||
AssertEquals('begin end block',TPasImplBeginBlock,OuterIf.ElseBranch.ClassType);
|
||||
end;
|
||||
|
||||
|
||||
procedure TTestStatementParser.TestWhile;
|
||||
|
||||
Var
|
||||
|
Loading…
Reference in New Issue
Block a user