Difference between revisions of "ASSERT"

From Recital Documentation Wiki
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=ASSERT=
 
 
 
==Class==
 
Error Handling and Debugging
 
 
 
 
==Purpose==
 
==Purpose==
 
Display a message dialog with options when a condition evaluates to False
 
Display a message dialog with options when a condition evaluates to False
Line 19: Line 12:
  
 
==Description==
 
==Description==
The ASSERT command is used for program debugging purposes: to display a message dialog with options when a condition evaluates to False (.F.).  The condition is specified in <expL>.  An optional message can be specified using the MESSAGE <expC>clause.  If no message is specified; the default message is:
+
The ASSERT command is used for program debugging purposes: to display a message dialog with options when a condition evaluates to False (.F.).  The condition is specified in <expL>.  An optional message can be specified using the MESSAGE <expC> clause.  If no message is specified; the default message is:
 +
 
  
 
<pre>Assertion failed on line <&#035;> of
 
<pre>Assertion failed on line <&#035;> of
 
           procedure <prg>.</pre>
 
           procedure <prg>.</pre>
 +
  
 
The dialog has four buttons, offering the following options:
 
The dialog has four buttons, offering the following options:
Line 36: Line 31:
 
|Ignore||Continues program execution.
 
|Ignore||Continues program execution.
 
|-
 
|-
|Ignore All||Continues program execution and issue SET ASSERTS OFF, causing subsequent asserts to be ignored.
+
|Ignore All||Continues program execution and issues SET ASSERTS OFF, causing subsequent asserts to be ignored.
 
|-
 
|-
 
|}
 
|}
Line 47: Line 42:
 
<code lang="recital">
 
<code lang="recital">
 
set asserts on
 
set asserts on
parameters para1, para2, para3
+
 
assert pcount() = 3 message [3 parameters required]
+
procedure proc1
// code continues
+
  parameters para1, para2, para3
 +
  assert pcount() = 3 message [3 parameters required]
 +
  // code continues
 
return
 
return
 
</code>
 
</code>
Line 55: Line 52:
  
 
==Products==
 
==Products==
Recital Mirage Server, Recital Terminal Developer
+
Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Error Handling and Debugging]]
 +
[[Category:Error Handling and Debugging Commands]]

Latest revision as of 10:07, 27 July 2010

Purpose

Display a message dialog with options when a condition evaluates to False


Syntax

ASSERT <expL> [MESSAGE <expC>]


See Also

DEBUG, SET ASSERTS, SET COMPILE


Description

The ASSERT command is used for program debugging purposes: to display a message dialog with options when a condition evaluates to False (.F.). The condition is specified in <expL>. An optional message can be specified using the MESSAGE <expC> clause. If no message is specified; the default message is:


Assertion failed on line <#> of
           procedure <prg>.


The dialog has four buttons, offering the following options:


Button Option
Debug Suspends program execution and starts the Debugger. The Debug option is only available if the program is being run uncompiled.
Cancel Stops program execution.
Ignore Continues program execution.
Ignore All Continues program execution and issues SET ASSERTS OFF, causing subsequent asserts to be ignored.


If SET ASSERTS is OFF, asserts are ignored. SET ASSERTS is OFF by default.


Example

set asserts on
 
procedure proc1
  parameters para1, para2, para3
  assert pcount() = 3 message [3 parameters required]
  // code continues
return


Products

Recital