A.14 library(debug): Print debug messages and test assertions
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(debug): Print debug messages and test assertions
          • debugging/1
          • debugging/2
          • debug/1
          • nodebug/1
          • list_debug_topics/0
          • debug_message_context/1
          • debug/3
          • debug_print_hook/3
          • assertion/1
          • assertion_failed/2
    • Packages
Availability::- use_module(library(debug)).(can be autoloaded)
Source[det]assertion(:Goal)
Acts similar to C assert() macro. It has no effect if Goal succeeds. If Goal fails or throws an exception, the following steps are taken:

  • call prolog:assertion_failed/2. If prolog:assertion_failed/2 fails, then:

    • If this is an interactive toplevel thread, print a message, the stack-trace, and finally trap the debugger.
    • Otherwise, throw error(assertion_error(Reason, G),_) where Reason is one of fail or the exception raised.