Changeset 8 for trunk/UTest.pas
- Timestamp:
- Aug 20, 2022, 8:22:00 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTest.pas
r7 r8 4 4 5 5 uses 6 Classes, SysUtils, USubversion,FileUtil, Generics.Collections;6 Classes, SysUtils, FileUtil, Generics.Collections; 7 7 8 8 type … … 16 16 TestResult: TTestResult; 17 17 Log: string; 18 procedure Initialize; virtual; 18 19 procedure Run; virtual; 20 procedure Finalize; virtual; 19 21 procedure Evaluate(Passed: Boolean); 20 22 procedure Pass; … … 32 34 end; 33 35 34 { TTestCaseSvn }35 36 TTestCaseSvn = class(TTestCase)37 private38 Subversion: TExecute;39 SubversionAdmin: TSubversionAdmin;40 function CheckError(Text: string): Boolean;41 protected42 RepoDir: string;43 WorkDir: string;44 TestDir: string;45 procedure Svn(Parameters: array of string);46 procedure SvnAdmin(Parameters: array of string);47 public48 procedure Run; override;49 constructor Create; override;50 destructor Destroy; override;51 end;52 36 53 37 resourcestring … … 64 48 65 49 implementation 66 67 uses68 USvnZero;69 50 70 51 procedure Translate; … … 91 72 { TTestCase } 92 73 74 procedure TTestCase.Initialize; 75 begin 76 end; 77 93 78 procedure TTestCase.Run; 79 begin 80 end; 81 82 procedure TTestCase.Finalize; 94 83 begin 95 84 end; … … 129 118 Passed: Integer; 130 119 Failed: Integer; 131 LastDir: string;132 120 begin 133 121 for I := 0 to Count - 1 do 134 122 with Items[I] do begin 135 123 WriteLn('== ' + Name + ' ======= '); 136 LastDir := GetCurrentDir;124 Initialize; 137 125 Run; 138 ChDir(LastDir);126 Finalize; 139 127 end; 140 128 … … 151 139 end; 152 140 153 { TTestCaseSvn }154 155 procedure TTestCaseSvn.Svn(Parameters: array of string);156 begin157 Subversion.ExecuteOutput(Parameters);158 if CheckError(Subversion.ErrorOutput) then159 TestResult := trFailed;160 end;161 162 procedure TTestCaseSvn.SvnAdmin(Parameters: array of string);163 begin164 SubversionAdmin.ExecuteOutput(Parameters);165 if CheckError(SubversionAdmin.ErrorOutput) then166 TestResult := trFailed;167 end;168 169 function TTestCaseSvn.CheckError(Text: string): Boolean;170 begin171 Result := Pos('svn: E', Text) > 0;172 end;173 174 procedure TTestCaseSvn.Run;175 begin176 ChDir(TestDir);177 end;178 179 constructor TTestCaseSvn.Create;180 begin181 TestDir := GetTempDir(False) + 'SVNZero';182 ForceDirectories(TestDir);183 RepoDir := TestDir + DirectorySeparator + 'Repo';184 WorkDir := TestDir + DirectorySeparator + 'Work';185 //Subversion := TSubversion.Create;186 Subversion := TSvnZero.Create;187 SubversionAdmin := TSubversionAdmin.Create;188 end;189 190 destructor TTestCaseSvn.Destroy;191 begin192 FreeAndNil(SubversionAdmin);193 FreeAndNil(Subversion);194 inherited;195 end;196 197 141 end. 198 142
Note:
See TracChangeset
for help on using the changeset viewer.