cmake_test/asserts/file_contains

cmake_test/asserts/file_contains.ct_assert_file_contains(file text)

Assert a file contains the specified text.

Asserts that the file at the specified path contains the specified text. If the file does not exist or does not contain the specified contents, an ASSERTION_FAILED exception is raised.

Parameters:
  • file (path) – The file to check

  • text (str) – The text to check for

cmake_test/asserts/file_contains.ct_assert_file_does_not_contain(file text)

Assert a file does not contain the specified text.

Asserts that the file at the specified path does not contain the specified text.

If the path does not exist or the file at that path does contain the text, an ASSERTION_FAILED exception will be raised.

Parameters:
  • file (path) – The file to check

  • text (str) – The text to check for

cmake_test/asserts/file_contains.ct_file_contains(result file text)

Determines if a file contains some text.

This function checks whether a file contains some text and returns a boolean result.

Will raise an ASSERTION_FAILED exception if the file does not exist.

Parameters:
  • result (bool*) – Name to use for the variable which will hold the result.

  • file (path) – The file to check.

  • text (str) – The text to check for.

Returns:

result will be set to TRUE if file contains the text and FALSE if it does not.

Return type:

bool