bug0150.pp 604 B

123456789101112131415161718192021222324252627
  1. programs bug0150;
  2. {
  3. bug to show that there is no assert() macro and directive
  4. }
  5. var B : boolean;
  6. i : integer;
  7. begin
  8. b:=true;
  9. i:=0;
  10. // First for assert messages should not give anything.
  11. // First two generate code, but are OK.
  12. // second two don't generate code ($C- !)
  13. {$c+}
  14. assert (b);
  15. assert (I=0);
  16. {$c-}
  17. assert (not(b));
  18. assert (i<>0);
  19. {$c+}
  20. // This one should give the normal assert message.
  21. assert (not(b));
  22. // This one should give a custom assert message.
  23. // you must uncomment the previous one to see this one.
  24. assert (not(I=0),'Custom assert message');
  25. end.