The Ada Program: main.adb

  1 --  main.adb:  pragma "Assert" in GNAT and exception information
  2 
  3 with Ada.Text_IO, Ada.Exceptions, System.Assertions;
  4 use Ada;
  5 
  6 procedure Main is
  7 begin
  8    null;
  9    --  GNAT compiler requires "-gnata"; ow, no check
 10    pragma Assert (False, "Assertion is false!");
 11 exception
 12    when E:System.Assertions.Assert_Failure =>
 13       Text_IO.Put ("Name   :  ");
 14       Text_IO.Put_Line (Exceptions.Exception_Name (E));
 15       Text_IO.Put ("Message:  ");
 16       Text_IO.Put_Line (Exceptions.Exception_Message (E));
 17       Text_IO.Put ("Info   :  ");
 18       Text_IO.Put_Line (Exceptions.Exception_Information (E));
 19 end Main;