Diagnostic using a value's displayed output
The DisplayDiagnostic class provides a diagnostic result using a value's displayed output. This output is the same text displayed using the display function. When the diagnostic information is accessible through a variable in the current workspace, the DisplayDiagnostic class is a means to provide quick diagnostic information.
DisplayDiagnostic(diagValue) creates a new DisplayDiagnostic instance.
The value used by the Diagnostic to generate diagnostic information.
The resulting diagnostic information will be equivalent to displaying this value at the MATLAB command prompt. The result will be packaged for consumption by the testing framework, which may or may not display the information at the command prompt.
The value which the Diagnostic uses to generate diagnostic information, specified in the diagValue input argument. This property is read-only.
The DiagnosticResult property provides the means by which the actual diagnostic information is communicated to consumers of diagnostics, such as testing frameworks. The property is a string that is defined during evaluation of the diagnose method.
|diagnose||Execute diagnostic action|
|join||Join multiple diagnostics into a single array|
Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB® documentation.
import matlab.unittest.constraints.IsEqualTo; import matlab.unittest.diagnostics.DisplayDiagnostic; % Create a TestCase for interactive use testCase = matlab.unittest.TestCase; % Provide a DisplayDiagnostic as a Test Diagnostic testCase.verifyThat(1, IsEqualTo(2), DisplayDiagnostic(5) );