Changeset 7


Ignore:
Timestamp:
Aug 19, 2022, 11:04:03 PM (2 years ago)
Author:
chronos
Message:
  • Added: Merge test.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SVNZero.lpr

    r6 r7  
    3131    with TTestCases.Create do
    3232    try
    33       AddNew('Add', TTestCaseAdd);
     33{      AddNew('Add', TTestCaseAdd);
    3434      AddNew('Update', TTestCaseUpdate);
    3535      AddNew('Modify', TTestCaseModify);
    3636      AddNew('Delete', TTestCaseDelete);
     37 }     AddNew('Merge', TTestCaseMerge);
    3738      Run;
    3839    finally
  • trunk/UTest.pas

    r6 r7  
    129129  Passed: Integer;
    130130  Failed: Integer;
     131  LastDir: string;
    131132begin
    132133  for I := 0 to Count - 1 do
    133134  with Items[I] do begin
    134135    WriteLn('== ' + Name + ' ======= ');
     136    LastDir := GetCurrentDir;
    135137    Run;
     138    ChDir(LastDir);
    136139  end;
    137140
  • trunk/UTestCases.pas

    r6 r7  
    2323  end;
    2424
     25  { TTestCaseMerge }
     26
     27  TTestCaseMerge = class(TTestCaseSvn)
     28    procedure Run; override;
     29  end;
     30
    2531
    2632implementation
     33
     34{ TTestCaseMerge }
     35
     36procedure TTestCaseMerge.Run;
     37var
     38  TestFile: string;
     39begin
     40  TestFile := 'TestFile.txt';
     41  SvnAdmin(['create', RepoDir]);
     42  Svn(['checkout', 'file:///' + RepoDir, WorkDir]);
     43  ChDir(WorkDir);
     44  SaveStringToFile('First line' + LineEnding + 'Second line' + LineEnding + 'Third line', TestFile);
     45  Svn(['add', TestFile]);
     46  Svn(['commit', '-m', '"Commit message"']);
     47  SaveStringToFile('First line' + LineEnding + 'Second line' + LineEnding + 'Third line 2', TestFile);
     48  Svn(['commit', '-m', '"Commit message 2"']);
     49  Svn(['update', '-r', '1', TestFile]);
     50  SaveStringToFile('First line 2' + LineEnding + 'Second line' + LineEnding + 'Third line', TestFile);
     51  Svn(['update', TestFile]);
     52  Svn(['commit', '-m', '"Commit message 3"']);
     53  DeleteDirectory(WorkDir, False);
     54  DeleteDirectory(RepoDir, False);
     55  Evaluate(True);
     56end;
    2757
    2858procedure TTestCaseAdd.Run;
    2959var
    3060  TestFile: string;
    31   LastDir: string;
    3261begin
    33   TestResult := trNone;
    34   LastDir := GetCurrentDir;
    3562  TestFile := 'TestFile.txt';
    3663  SvnAdmin(['create', RepoDir]);
     
    4067  Svn(['add', TestFile]);
    4168  Svn(['commit', '-m', '"Commit message"']);
    42   ChDir(LastDir);
    4369  DeleteDirectory(WorkDir, False);
    4470  DeleteDirectory(RepoDir, False);
     
    4975var
    5076  TestFile: string;
    51   LastDir: string;
    5277begin
    53   TestResult := trNone;
    54   LastDir := GetCurrentDir;
    5578  TestFile := 'TestFile.txt';
    5679  SvnAdmin(['create', RepoDir]);
     
    6285  SaveStringToFile('Different text', TestFile);
    6386  Svn(['commit', '-m', '"Commit message 2"']);
    64   ChDir(LastDir);
    6587  DeleteDirectory(WorkDir, False);
    6688  DeleteDirectory(RepoDir, False);
     
    7193var
    7294  TestFile: string;
    73   LastDir: string;
    7495begin
    75   TestResult := trNone;
    76   LastDir := GetCurrentDir;
    7796  TestFile := 'TestFile.txt';
    7897  SvnAdmin(['create', RepoDir]);
     
    86105  Svn(['update', '-r', '1', TestFile]);
    87106  Svn(['update']);
    88   ChDir(LastDir);
    89107  DeleteDirectory(WorkDir, False);
    90108  DeleteDirectory(RepoDir, False);
     
    95113var
    96114  TestFile: string;
    97   LastDir: string;
    98115begin
    99   TestResult := trNone;
    100   LastDir := GetCurrentDir;
    101116  TestFile := 'TestFile.txt';
    102117  SvnAdmin(['create', RepoDir]);
     
    108123  Svn(['delete', TestFile]);
    109124  Svn(['commit', '-m', '"Commit message 2"']);
    110   ChDir(LastDir);
    111125  DeleteDirectory(WorkDir, False);
    112126  DeleteDirectory(RepoDir, False);
Note: See TracChangeset for help on using the changeset viewer.