mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 13:39:36 +02:00
* Add inherited to setup/teardown
git-svn-id: trunk@22406 -
This commit is contained in:
parent
fcb3d0c256
commit
76b9b4fdac
@ -86,7 +86,7 @@ Type
|
||||
// Create implementation of test code. After 'Implementation' keyword was added
|
||||
procedure CreateImplementationCode(C: TStrings); virtual;
|
||||
// Add a test method body to the implementation. AddFail=True adds a Fail statement.
|
||||
procedure AddMethodImpl(C: TStrings; Const AClassName, AMethodName: String; AddFail: Boolean);virtual;
|
||||
procedure AddMethodImpl(C: TStrings; Const AClassName, AMethodName: String; AddFail: Boolean; AddInherited : Boolean = false);virtual;
|
||||
// Called when all the methods of a class have been emitted. Empty.
|
||||
procedure EndTestClassImpl(C: TStrings; Const AClassName: String);virtual;
|
||||
// Create interface test code. After uses clause of interface section.
|
||||
@ -510,7 +510,7 @@ begin
|
||||
EndTestClassDecl(C,CN);
|
||||
end;
|
||||
|
||||
procedure TFPTestCodeCreator.AddMethodImpl(C : TStrings; Const AClassName,AMethodName : String; AddFail : Boolean);
|
||||
procedure TFPTestCodeCreator.AddMethodImpl(C : TStrings; Const AClassName,AMethodName : String; AddFail : Boolean; AddInherited : Boolean = false);
|
||||
|
||||
begin
|
||||
C.Add('');
|
||||
@ -519,6 +519,8 @@ begin
|
||||
C.Add('begin');
|
||||
if AddFail then
|
||||
C.Add(Format(' Fail(''%s'');',[FM]));
|
||||
if AddInherited then
|
||||
C.Add(' Inherited;');
|
||||
C.Add('end;');
|
||||
C.Add('');
|
||||
end;
|
||||
@ -530,9 +532,9 @@ begin
|
||||
C.Add(' { '+AClassName+' }');
|
||||
C.Add('');
|
||||
if coSetup in CodeOptions then
|
||||
AddMethodImpl(C,AClassName,'Setup',False);
|
||||
AddMethodImpl(C,AClassName,'Setup',False,True);
|
||||
if coTearDown in CodeOptions then
|
||||
AddMethodImpl(C,AClassName,'TearDown',False);
|
||||
AddMethodImpl(C,AClassName,'TearDown',False,True);
|
||||
end;
|
||||
|
||||
procedure TFPTestCodeCreator.EndTestClassImpl(C : TStrings; Const AClassName : String);
|
||||
|
Loading…
Reference in New Issue
Block a user