checkTestSuffix

Checks if the configured suffix is reserved for unit test files. Unit test files can be classdefs, functions or scripts. What is considered to be a unit test file by CC4M is defined as follows:

  • Classdef files: A method is defined within a methods block that has the Test attribute. If the class meta information could not be obtained (for example because the calculation of a default value of a property triggered an error), the file is not considered a test file.

  • Function files:

    • The MATLAB-shipped functiontests function is called in the main function of the file.

    • The file name starts or ends with test (case-insensitive).

  • Scripts: The file name starts or ends with test (case-insensitive).

This check reports files in two situations:

  1. If the file is considered a test file but it is not suffixed with the configured suffix.

  2. If the file is not considered a test file but it is suffixed with the configured suffix.

Configurable parameters

  • Suffix (string): The suffix to reserve for unit test files.

Exemption tag: %@ok<TSTSF>