Kernel Toolkit 7.3 APIs Banner
Office of Information and Technology (OIT) Banner
[skip navigation]

CHKLEAKS^XTMUNIT(): Check for Variable Leaks

Reference Type: N/A; Not callable from outside a unit test, Category: Toolkit—M Unit Utility, ICR#: N/A

Description

The 27.7.8 CHKLEAKS^XTMUNIT API runs a test that can be used within unit tests or in a standalone test for variable leaks (those created within called code that are allowed to leak into the calling environment, unintentionally).

NOTE: None of the M Unit Utility Application Programming Interfaces (APIs), extrinsic functions, or sections of code in the M Unit are callable from outside a unit test, but are all part of a unit test. M UNIT is a self-contained application.

REF: For an overview and more details of the M Unit Utility, see the "Toolkit—M Unit Utility" section in the Kernel 8.0 & Kernel Toolkit 7.3 Developer's Guide.

Format

  D CHKLEAKS^XTMUNIT(code,testloc,.nameinpt)

Input Parameters

code:

(required) Contains a command to be executed in the test for leaks. For example:

     S X=$$NOW^XLFDT()
testloc:

(required) Indicates the location under test. For example:

     $$NOW^XLFDT() leak test

Or simply:

     $$NOW^XLFDT
.nameinpt:

(required) This parameter is passed by reference, and is an array that contains a list of all variables that the user is passing in and/or expects to be present when the code is finished (the variable X would be in the latter category, since it would then be present). The input is in the form of an array:

     NAMEINPT(“VARNAME”)=“VARVALUE”

Where:

  • VARNAME—Name of a variable.

  • VARVALUE—Value that is to be assigned to the variable before the contents of the code input parameter is to be executed.

Output

returns:

Returns:

  • Inside a unit test environment—When run in a unit test environment, variables that are present after the contents of the code input parameter is executed that were not included in NAMEINPT array as variables, are listed as failures.

  • Outside a unit test environment—When called outside of a unit test environment, any leaked variables are listed on the current device.