SynEdit: highlight class "helper". Fix wrong highlight of "sealed" Issue #0021812 Tests

git-svn-id: trunk@37113 -
This commit is contained in:
martin 2012-04-30 18:59:10 +00:00
parent a8c17c1034
commit b4d22ba095

View File

@ -45,6 +45,7 @@ type
procedure TestContextForProcedure;
procedure TestContextForDeprecated;
procedure TestContextForClassModifier; // Sealed abstract
procedure TestContextForClassHelper;
procedure TestContextForStatic;
procedure TestFoldNodeInfo;
end;
@ -741,6 +742,85 @@ begin
CheckTokensForLine('class declaration"', 2,
[ tkIdentifier, tkSpace, tkSymbol, tkSpace,
tkKey {class}, tkSpace,
tkKey {sealed}, tkSpace, tkKey {abstract}
]);
CheckTokensForLine('var in class "', 3,
[ tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol,
tkSpace, tkIdentifier, tkSymbol
]);
CheckTokensForLine('procedure in class "', 4,
[ tkKey, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkKey, tkSymbol ]);
ReCreateEdit;
SetLines
([ 'Unit A; interface',
'type',
'TFoo = class {} sealed abstract',
'a, sealed, abstract: Integer;',
'procedure Foo; abstract;',
'end;',
''
]);
CheckTokensForLine('class declaration"', 2,
[ tkIdentifier, tkSpace, tkSymbol, tkSpace,
tkKey {class}, tkSpace, tkComment, tkSpace,
tkKey {sealed}, tkSpace, tkKey {abstract}
]);
CheckTokensForLine('var in class "', 3,
[ tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol,
tkSpace, tkIdentifier, tkSymbol
]);
CheckTokensForLine('procedure in class "', 4,
[ tkKey, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkKey, tkSymbol ]);
ReCreateEdit;
SetLines
([ 'Unit A; interface',
'type',
'TFoo = class {}',
' sealed abstract',
'a, sealed, abstract: Integer;',
'procedure Foo; abstract;',
'end;',
''
]);
CheckTokensForLine('class declaration"', 2,
[ tkIdentifier, tkSpace, tkSymbol, tkSpace,
tkKey {class}, tkSpace, tkComment
]);
CheckTokensForLine('class declaration"', 3,
[ tkSpace, tkKey {sealed}, tkSpace, tkKey {abstract}
]);
CheckTokensForLine('var in class "', 4,
[ tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol,
tkSpace, tkIdentifier, tkSymbol
]);
CheckTokensForLine('procedure in class "', 5,
[ tkKey, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkKey, tkSymbol ]);
ReCreateEdit;
SetLines
([ 'Unit A; interface',
'type',
'TFoo = class(sealed) sealed abstract',
'helper, sealed, abstract: Integer;',
'procedure Foo; abstract;',
'end;',
''
]);
CheckTokensForLine('class declaration"', 2,
[ tkIdentifier, tkSpace, tkSymbol, tkSpace,
tkKey {class}, tkSymbol, tkIdentifier, tkSymbol, tkSpace,
tkKey {sealed}, tkSpace,
tkKey {abstract}
]);
@ -751,6 +831,34 @@ begin
CheckTokensForLine('procedure in class "', 4,
[ tkKey, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkKey, tkSymbol ]);
end;
procedure TTestHighlighterPas.TestContextForClassHelper;
begin
ReCreateEdit;
SetLines
([ 'Unit A; interface',
'type',
'TFoo = class helper for TBar',
'helper, sealed, abstract: Integer;',
'procedure Foo; abstract;',
'end;',
''
]);
CheckTokensForLine('class declaration"', 2,
[ tkIdentifier, tkSpace, tkSymbol, tkSpace,
tkKey {class}, tkSpace, tkKey {helper}, tkSpace, tkKey {for},
tkSpace, tkIdentifier
]);
CheckTokensForLine('var in class "', 3,
[ tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkIdentifier, tkSymbol,
tkSpace, tkIdentifier, tkSymbol
]);
CheckTokensForLine('procedure in class "', 4,
[ tkKey, tkSpace, tkIdentifier, tkSymbol, tkSpace, tkKey, tkSymbol ]);
end;
procedure TTestHighlighterPas.TestContextForStatic;