Checks whether an expression is Null in assertive programming and in automated test mode.
// If FindCustomer is a procedure used to find a customer identified by its name and that returns
// the CCustomer object corresponding to the customer if the customer is known and Null otherwise
// A customer who already exists must not be added
TestCheckNull(FindCustomer(CustomerName), "Customer '%1' is already known", CustomerName)
// Adds the customer
AddCustomer(CustomerName)
Syntax
TestCheckNull(<Expression> [, <Comments> [, <Parameter 1> [... [, <Parameter N>]]]])
<Expression>: Character string
Expression that must be checked.
<Comments>: Character string
Character string in the format defined by StringBuild.
<Parameter 1>: Any type
First parameter expected by <Comments>.
<Parameter N>: Any type
Nth parameter expected by <Comments>.
Remarks
Operating mode
When the expression is not Null:
- in manual test mode, an assertion is displayed (equivalent to dbgAssert).
- in runtime mode, an assertion is displayed if the assertions have been enabled (equivalent to dbgAssert).
When running an application, the expression is not evaluated if the assertions are not enabled.
dbgOnError allows you to automatically start a WLanguage procedure used to retrieve the comment linked to the error.