Changeset 152 for trunk/Test.pas
- Timestamp:
- Jun 6, 2023, 5:05:18 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Test.pas
r149 r152 4 4 5 5 uses 6 Classes, SysUtils, VCard, TestCase;6 Classes, SysUtils, VCard, VCardProcessor, TestCase; 7 7 8 8 type … … 29 29 end; 30 30 31 { TTestCaseVCardProcessor } 32 33 TTestCaseVCardProcessor = class(TTestCase) 34 Input: string; 35 Output: string; 36 Processor: TVCardProcessor; 37 procedure Run; override; 38 constructor Create; override; 39 destructor Destroy; override; 40 end; 41 31 42 32 43 implementation … … 38 49 SExpected = 'Expected:'; 39 50 SOutput = 'Output:'; 51 52 { TTestCaseVCardProcessor } 53 54 procedure TTestCaseVCardProcessor.Run; 55 var 56 Lines: TStringList; 57 begin 58 Lines := TStringList.Create; 59 try 60 with TVCardFile.Create(nil) do 61 try 62 Lines.Text := Input; 63 VCard.LoadFromStrings(Lines); 64 65 Processor.Process(VCard); 66 67 Lines.Text := ''; 68 VCard.SaveToStrings(Lines); 69 Evaluate(Lines.Text = Output); 70 Log := SExpected + LineEnding + 71 '"' + Output + '"' + LineEnding + LineEnding + 72 SOutput + LineEnding + 73 '"' + Lines.Text + '"'; 74 finally 75 Free; 76 end; 77 finally 78 Lines.Free; 79 end; 80 end; 81 82 constructor TTestCaseVCardProcessor.Create; 83 begin 84 inherited; 85 Processor := TVCardProcessor.Create(nil); 86 end; 87 88 destructor TTestCaseVCardProcessor.Destroy; 89 begin 90 FreeAndNil(Processor); 91 inherited; 92 end; 40 93 41 94 { TTestCaseCheckProperty }
Note:
See TracChangeset
for help on using the changeset viewer.