mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 11:29:20 +02:00
* Test for bug ID #27760
git-svn-id: trunk@47016 -
(cherry picked from commit 4ad6c98d82
)
This commit is contained in:
parent
3f5948739a
commit
5154300ed9
@ -71,6 +71,7 @@ Type
|
||||
procedure TestIfWithBlock;
|
||||
Procedure TestNestedIf;
|
||||
Procedure TestNestedIfElse;
|
||||
Procedure TestNestedIfElseElse;
|
||||
Procedure TestWhile;
|
||||
Procedure TestWhileBlock;
|
||||
Procedure TestWhileNested;
|
||||
@ -714,6 +715,32 @@ begin
|
||||
AssertEquals('begin end block',TPasImplBeginBlock,I.ElseBranch.ClassType);
|
||||
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;
|
||||
|
||||
Var
|
||||
|
Loading…
Reference in New Issue
Block a user