demotests.pp 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. unit demotests;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, fpcunit, testregistry;
  6. Type
  7. { TMyTestCase }
  8. TMyTestCase = Class(TTestCase)
  9. Published
  10. Procedure TestWillFail;
  11. Procedure TestMustFail;
  12. Procedure TestWillError;
  13. Procedure TestWillWork;
  14. Procedure TestWillWorkToo;
  15. Procedure TestWillDefinitelyWork;
  16. Procedure TestWeLLIgnoreThisOne;
  17. end;
  18. implementation
  19. { TMyTestCase }
  20. procedure TMyTestCase.TestWillFail;
  21. begin
  22. Fail('Aarrggghhhhh this test failed');
  23. end;
  24. procedure TMyTestCase.TestMustFail;
  25. begin
  26. Fail('Uh-oh, this test failed too...');
  27. end;
  28. procedure TMyTestCase.TestWillError;
  29. begin
  30. Raise Exception.Create('A random error');
  31. end;
  32. procedure TMyTestCase.TestWillWork;
  33. begin
  34. end;
  35. procedure TMyTestCase.TestWillWorkToo;
  36. begin
  37. end;
  38. procedure TMyTestCase.TestWillDefinitelyWork;
  39. begin
  40. end;
  41. procedure TMyTestCase.TestWeLLIgnoreThisOne;
  42. begin
  43. Ignore('Not today, thank you!')
  44. end;
  45. initialization
  46. RegisterTest('DemoSuite',TMyTestCase);
  47. end.