Changeset 168 for trunk/Test.pas
- Timestamp:
- Jul 1, 2023, 8:17:50 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Test.pas
r152 r168 4 4 5 5 uses 6 Classes, SysUtils, VCard, VCardProcessor, TestCase ;6 Classes, SysUtils, VCard, VCardProcessor, TestCase, Table; 7 7 8 8 type … … 40 40 end; 41 41 42 { TTestCaseVCardExportImport } 43 44 TTestCaseVCardExportImport = class(TTestCase) 45 Input: string; 46 Output: string; 47 Format: TTableFormat; 48 HumanReadableHeader: Boolean; 49 procedure Run; override; 50 end; 51 42 52 43 53 implementation … … 49 59 SExpected = 'Expected:'; 50 60 SOutput = 'Output:'; 61 SExport = 'Export:'; 62 63 { TTestCaseVCardExportImport } 64 65 procedure TTestCaseVCardExportImport.Run; 66 var 67 Lines: TStringList; 68 ExportedLines: TStringList; 69 begin 70 Lines := TStringList.Create; 71 ExportedLines := TStringList.Create; 72 try 73 with TVCardFile.Create(nil) do 74 try 75 Lines.Text := Input; 76 VCard.LoadFromStrings(Lines); 77 78 VCard.ExportToStrings(ExportedLines, Format, HumanReadableHeader); 79 VCard.Contacts.Clear; 80 VCard.ImportFromStrings(ExportedLines, Format, HumanReadableHeader); 81 82 Lines.Text := ''; 83 VCard.SaveToStrings(Lines); 84 Evaluate(Lines.Text = Output); 85 Log := SExpected + LineEnding + 86 '"' + Output + '"' + LineEnding + LineEnding + 87 SExport + LineEnding + 88 '"' + ExportedLines.Text + '"' + LineEnding + LineEnding + 89 SOutput + LineEnding + 90 '"' + Lines.Text + '"'; 91 finally 92 Free; 93 end; 94 finally 95 FreeAndNil(Lines); 96 FreeAndNil(ExportedLines); 97 end; 98 end; 51 99 52 100 { TTestCaseVCardProcessor }
Note:
See TracChangeset
for help on using the changeset viewer.