Skip to main content

Assertions

Command run assertions

Use these after running a command with run.

Function NameDescription
assert_successAsserts that a command succeeds
assert_failureAsserts that a command fails
assert_outputAsserts that a command outputs an exact string
assert_output_containsChecks if output contains a specific string
assert_output_not_containsChecks if output does not contain a specific string

String assertions

Function NameDescription
assert_emptyAsserts that a string is empty
assert_equalAsserts that two string are equal
assert_containsAsserts that a string contains a given substring
assert_not_containsAsserts that a string does not contain a substring

File assertions

Function NameDescription
assert_file_existsAsserts that a file exists
assert_file_not_existsAsserts that a file does not exist
assert_file_containsChecks if a file contains a specific string
assert_file_not_containsChecks if a file does not contain a specific string
assert_files_equalAsserts that two files are equal
assert_files_not_equalAsserts that two files are not equal
assert_file_modeChecks the file permission mode
assert_binary_files_equalChecks if two binary files are equal
assert_binary_files_not_equalChecks if two binary files are not equal
assert_dir_existsAsserts that a directory exists
assert_dir_not_existsAsserts that a directory does not exist
assert_dir_emptyAsserts that a directory is empty
assert_dir_not_emptyAsserts that a directory is not empty
assert_dir_contains_stringChecks if directory contains a specific string
assert_dir_not_contains_stringChecks if directory does not contain a specific string
assert_dirs_equalAsserts that two directories are equal
assert_symlink_existsAsserts that a symbolic link exists
assert_symlink_not_existsAsserts that a symbolic link does not exist

Git assertions

Function NameDescription
assert_git_repoAsserts that a directory is a git repository
assert_git_cleanAsserts that a git repository is clean
assert_git_not_cleanAsserts that a git repository is not clean
assert_git_file_is_trackedChecks if a file is tracked in git
assert_git_file_is_not_trackedChecks if a file is not tracked in git