HeaderListTest.pas 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 11257: HeaderListTest.pas
  11. {
  12. { Rev 1.0 11/12/2002 09:18:24 PM JPMugaas
  13. { Initial check in. Import from FTP VC.
  14. }
  15. unit HeaderListTest;
  16. interface
  17. uses IndyBox,
  18. IdHeaderList;
  19. type
  20. THeaderListProc = class(TIndyBox)
  21. public
  22. procedure Test; override;
  23. end;
  24. implementation
  25. { THeaderListProc }
  26. procedure THeaderListProc.Test;
  27. var h : TIdHeaderList;
  28. begin
  29. h := TIdHeaderList.Create;
  30. try
  31. h.Add('Subject: This is a');
  32. h.Add(' folded line.');
  33. Check(h.Values['Subject']='This is a folded line.' ,'Wrong value');
  34. h.Values['Subject'] := '';
  35. Check(h.Count = 0,'HeaderList count should have been zero');
  36. h.Add('Subject: This is a');
  37. h.Add(' folded line.');
  38. h.Add('Subject2: This is a');
  39. h.Add(' folded line.');
  40. h.Values['Subject'] := '';
  41. Check(h.Count = 2,'HeaderList count should have been two.');
  42. Check(h.Values['Subject2']='This is a folded line.','Expected value not returned');
  43. h.Values['Subject2'] := '';
  44. h.Add('FirstValue: This is a');
  45. h.Add(' folded line.');
  46. h.Add('Dummy: This is a dummy line for a test');
  47. Check(h.Values['FirstValue']='This is a folded line.','Expected value not returned');
  48. finally
  49. h.Free;
  50. end;
  51. end;
  52. initialization
  53. TIndyBox.RegisterBox(THeaderListProc, 'HeaderList', 'Misc');
  54. end.