CHECK EXCEPTION

C++ Test Script Language

Purpose

The CHECK EXCEPTION statement checks that an exception is raised within a block.

Syntax

CHECK EXCEPTION ( <native type> [ <native parameter name> ] ) ( ( { <on exception item>} ) | ; )

Arguments

<native type> is the C++ type of the expected exception.

<native parameter name> is the optional name of the exception. It may also be used in <on exception item>.

<on exception item> may be a COMMENT, a PRINT or a native-code statement.

Description

The CHECK EXCEPTION statement specifies that the exception of type <native type> is expected to be raised in the current C++ Text Script Language block (test case or proc). If this exception is not raised in the block, an error is generated.

Only one CHECK EXCEPTION may occur per block. A CHECK EXCEPTION can be located in a TEST CASE or PROC block.

Example

TEST CASE TC1 {

       CHECK EXCEPTION (DivideByZeroException) {

              PRINT "ok";

       }

       #b = 1; c = 0;

       #a = b / c;

}

 

Related Topics

COMMENT | PRINT | TEST CASE | PROC | Error handling | Native code