* Add inherited to setup/teardown

git-svn-id: trunk@22406 -
This commit is contained in:
michael 2012-09-16 15:59:21 +00:00
parent fcb3d0c256
commit 76b9b4fdac

View File

@ -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);