Skip to content

Assert Tools

🛠️ Tools · ⬅ Top


These functions are solely available after you call testSuite. Check out our testing guide

Equality

assertEquals

Assert two strings are equal.

Usage

assertEquals expected actual [ message ]

Assert two strings are equal.

If this fails it will output an error and exit.

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - Expected string
  • actual - Actual string
  • message - Message to output if the assertion fails

Examples

assertEquals "$(alignRight 4 "hi")" "  hi" "alignRight not working"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertEquals was reviewed 2023-11-12 .

assertNotEquals

Assert two strings are not equal

Usage

assertNotEquals [ --help ] [ --line lineNumber ] [ --line-depth depth ] [ --debug ] [ --debug-lines ] [ --display ] [ --success ] [ --stderr-match ] [ --stdout-no-match ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --leak globalName ] [ --skip-plumber ] [ --dump ] [ --dump-binary ] [ --head ] [ --tail ] expected actual [ message ]

Assert two strings are not equal.

If this fails it will output an error and exit.

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - Required. Expected string.
  • actual - Required. Actual string.
  • message - Message to output if the assertion fails. Optional.

Examples

assertNotEquals "$(uname -s)" "FreeBSD" "Not compatible with FreeBSD"
Single quote break-s

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertNotEquals was reviewed 2023-11-12 .

assertContains

Assert one string contains another (case-sensitive)

Usage

assertContains needle haystack

Assert one string contains another (case-sensitive)

Return Code: 0 - The assertion succeeded Return Code: 1 - Assertion failed Return Code: 2 - Bad arguments

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • needle - String. Text we are looking for.
  • haystack ... - String. One or more strings to findneedlein - it must be found in all haystacks.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

assertNotContains

Assert one string does not contains another (case-sensitive)

Usage

assertNotContains needle haystack

Assert one string does not contains another (case-sensitive)

Return Code: 0 - The assertion succeeded Return Code: 1 - Assertion failed Return Code: 2 - Bad arguments

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • needle - String. Text we are looking for.
  • haystack ... - String. One or more strings to findneedlein - it must be found in no haystacks.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Empty String

assertStringEmpty

Assert a string is empty.

Usage

assertStringEmpty [ --help ] [ --line lineNumber ] [ --line-depth depth ] [ --debug ] [ --debug-lines ] [ --display ] [ --success ] [ --stderr-match ] [ --stdout-no-match ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --leak globalName ] [ --skip-plumber ] [ --dump ] [ --dump-binary ] [ --head ] [ --tail ] [ string ... ]

Assert a string is empty.

If this fails it will output an error and exit.

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • string ... - Empty strings

Examples

assertEquals "$(alignRight 4 "hi")" "  hi" "alignRight not working"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertStringEmpty was reviewed 2023-11-12 .

assertStringNotEmpty

Assert a string is non-empty.

Usage

assertStringNotEmpty [ --help ] [ --line lineNumber ] [ --line-depth depth ] [ --debug ] [ --debug-lines ] [ --display ] [ --success ] [ --stderr-match ] [ --stdout-no-match ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --leak globalName ] [ --skip-plumber ] [ --dump ] [ --dump-binary ] [ --head ] [ --tail ] [ string ... ]

Assert a string is non-empty.

If this fails it will output an error and exit.

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • string ... - Not empty strings

Examples

assertStringNotEmpty "$string"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertStringNotEmpty was reviewed 2023-11-12 .

Comparison

assertGreaterThan

Assert leftValue > rightValue

Usage

assertGreaterThan expected actual [ message ]

Assert leftValue > rightValue

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Value to compare on the left hand side of the comparison
  • rightValue - Value to compare on the right hand side of the comparison
  • message - Message to output if the assertion fails

Examples

assertGreaterThan 3 "$found"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertGreaterThan was reviewed 2023-11-14 .

assertGreaterThanOrEqual

Assert actual value is greater than or equal to expected value

Usage

assertGreaterThanOrEqual expected actual [ message ]

Assert leftValue >= rightValue

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Value to compare on the left hand side of the comparison
  • rightValue - Value to compare on the right hand side of the comparison
  • message - Message to output if the assertion fails

Examples

assertGreaterThanOrEqual 3 $found

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertGreaterThanOrEqual was reviewed 2023-11-12 .

assertLessThan

Assert leftValue < rightValue

Usage

assertLessThan expected actual [ message ]

Assert leftValue < rightValue

Return Code: 0 - expected less than to actual Return Code: 1 - expected greater than or equal to actual, or invalid numbers

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Value to compare on the left hand side of the comparison
  • rightValue - Value to compare on the right hand side of the comparison
  • message - Message to output if the assertion fails

Examples

assertLessThan 3 $found

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertLessThan was reviewed 2023-11-12 .

assertLessThanOrEqual

Assert leftValue <= rightValue

Usage

assertLessThanOrEqual leftValue rightValue [ message ]

Assert leftValue <= rightValue

Return Code: 0 - expected less than or equal to actual Return Code: 1 - expected greater than actual, or invalid numbers

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Value to compare on the left hand side of the comparison
  • rightValue - Value to compare on the right hand side of the comparison
  • message - Message to output if the assertion fails

Examples

assertLessThanOrEqual 3 $found

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertLessThanOrEqual was reviewed 2023-11-12 .

Exit code

assertExitCode

Assert a process runs and exits with the correct exit

Usage

assertExitCode [ expectedExitCode ] [ command ] [ arguments ] [ --help ] [ --line lineNumber ] [ --line-depth depth ] [ --debug ] [ --debug-lines ] [ --display ] [ --success ] [ --stderr-match ] [ --stdout-no-match ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --leak globalName ] [ --skip-plumber ] [ --dump ] [ --dump-binary ] [ --head ] [ --tail ]

Assert a process runs and exits with the correct exit code.

If this fails it will output an error and exit.

Return Code: 0 - If the process exits with the provided exit code Return Code: 1 - If the process exits with a different exit code

Arguments

  • expectedExitCode - UnsignedInteger. A numeric exit code expected from the command.
  • command - Callable. The command to run
  • arguments - Optional. Arguments. Any arguments to pass to the command to run
  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertExitCode was reviewed 2023-11-12 .

assertNotExitCode

Assert a process runs and exits with an exit code

Usage

assertNotExitCode [ expectedExitCode ] [ command ] [ arguments ] [ --help ] [ --line lineNumber ] [ --line-depth depth ] [ --debug ] [ --debug-lines ] [ --display ] [ --success ] [ --stderr-match ] [ --stdout-no-match ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --leak globalName ] [ --skip-plumber ] [ --dump ] [ --dump-binary ] [ --head ] [ --tail ]

Assert a process runs and exits with an exit code which does not match the passed in exit code.

If this fails it will output an error and exit.

Return Code: 0 - If the process exits with a different exit code Return Code: 1 - If the process exits with the provided exit code

Arguments

  • expectedExitCode - UnsignedInteger. A numeric exit code not expected from the command.
  • command - Callable. The command to run
  • arguments - Optional. Arguments. Any arguments to pass to the command to run
  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertNotExitCode was reviewed 2023-11-12 .

Output

assertOutputEquals

Assert output of a binary equals a string

Usage

assertOutputEquals expected binary [ parameters ]

Assert output of a binary equals a string

If this fails it will output an error and exit.

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - Expected string
  • binary - Binary to run and evaluate output
  • parameters - Any additional parameters to binary

Examples

assertOutputEquals "2023" date +%Y

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertOutputEquals was reviewed 2023-11-12 .

assertOutputContains

Run a command and expect the output to contain the

Usage

assertOutputContains expected command [ arguments ... ]

Run a command and expect the output to contain the occurrence of a string.

If this fails it will output the command result to stdout.

Return Code: 0 - If the output contains at least one occurrence of the string Return Code: 1 - If output does not contain string

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - A string to expect in the output
  • command - The command to run
  • arguments - Any arguments to pass to the command to run
  • --exit - Assert exit status of process to be this number
  • --stderr - Also include standard error in output checking

Examples

assertOutputContains Success complex-thing.sh --dry-run

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertOutputContains was reviewed 2023-11-12 .

assertOutputDoesNotContain

Run a command and expect the output to not contain

Usage

assertOutputDoesNotContain expected command [ arguments ... ]

Run a command and expect the output to not contain the occurrence of a string.

If this fails it will output the command result to stdout.

Return Code: 0 - If the output contains at least one occurrence of the string Return Code: 1 - If output does not contain string

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - A string to NOT expect in the output
  • command - The command to run
  • arguments - Any arguments to pass to the command to run
  • --exit - Assert exit status of process to be this number
  • --stderr - Also include standard error in output checking

Examples

assertOutputDoesNotContain Success complex-thing.sh --dry-run

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertOutputDoesNotContain was reviewed 2023-11-12 .

Directory

assertDirectoryExists

Test that a directory exists

Usage

assertDirectoryExists directory [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • directory - Directory that should exist
  • message - An error message if this fails

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • This fails if directory is anything but a directory

assertDirectoryDoesNotExist

Test that a directory does not exist

Usage

assertDirectoryDoesNotExist directory [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • directory - Directory that should NOT exist
  • message - An error message if this fails

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • This fails if directory is anything at all, even a non-directory (such as a link)

Review Status

File bin/build/tools/test/assert.sh, function assertDirectoryDoesNotExist was reviewed 2023-11-12 .

assertDirectoryEmpty

Test that a directory exists

Usage

assertDirectoryEmpty directory [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • directory - Directory that should exist and be empty
  • message - An error message if this fails

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • This fails if directory is anything but a directory

assertDirectoryNotEmpty

Test that a directory does not exist

Usage

assertDirectoryNotEmpty directory [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • directory - Directory that should exist and not be empty
  • message - An error message if this fails

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Review Status

File bin/build/tools/test/assert.sh, function assertDirectoryNotEmpty was reviewed 2023-11-12 .

File

assertFileExists

Test that a file exists

Usage

assertFileExists item [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • item - File that should exist
  • message - An error message if this fails

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • This fails if file is anything but a file

assertFileDoesNotExist

Test that a file does not exist

Usage

assertFileDoesNotExist item [ message ... ]

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • file - File that should NOT exist
  • message - An error message if this fails

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • This fails if file is anything at all, even a non-file (such as a link)

Review Status

File bin/build/tools/test/assert.sh, function assertFileDoesNotExist was reviewed 2023-11-12 .

assertFileContains

Assert a file contains one or more strings

Usage

assertFileContains fileName string0 [ ... ]

Assert a file contains one or more strings

Return Code: 0 - If the assertion succeeds Return Code: 1 - If the assertion fails

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName - File to search
  • string0 ... - One or more strings which must be found on at least one line in the file

Examples

assertFileContains $logFile Success
assertFileContains $logFile "is up to date"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.

Review Status

File bin/build/tools/test/assert.sh, function assertFileContains was reviewed 2023-11-12 .

assertFileDoesNotContain

Assert a file does not contains any occurrence of one

Usage

assertFileDoesNotContain fileName string0 [ ... ]

Assert a file does not contains any occurrence of one or more strings

Return Code: 1 - If the assertions fails Return Code: 0 - If the assertion succeeds

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName - File to search
  • string0 ... - One or more strings which must NOT be found anywhere in fileName

Examples

assertFileDoesNotContain $logFile error Error ERROR
assertFileDoesNotContain $logFile warning Warning WARNING

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.

FileSize

assertFileSize

Assert a file has an expected size in bytes

Usage

assertFileSize expectedSize [ fileName ... ]

Assert a file has an expected size in bytes

Return Code: 1 - If the assertions fails Return Code: 0 - If the assertion succeeds

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expectedSize - Integer file size which fileName should be, in bytes.
  • fileName ... - One ore more file which should be expectedSize bytes in size.

Examples

assertFileSize 22 .config
assertFileSize 0 .env

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.

assertNotFileSize

Assert a file does NOT have an expected size in

Usage

assertNotFileSize expectedSize [ fileName ... ]

Assert a file does NOT have an expected size in bytes

Return Code: 1 - If the assertions fails Return Code: 0 - If the assertion succeeds

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • expectedSize - Integer file size which fileName should NOT be, in bytes.
  • fileName ... - Required. File. One ore more file which should NOT be expectedSize bytes in size.

Examples

assertNotFileSize 22 .config
assertNotFileSize 0 .env

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.

assertZeroFileSize

Assert a file is empty (zero sized)

Usage

assertZeroFileSize [ fileName ... ]

Assert a file is empty (zero sized)

Return Code: 1 - If the assertions fails Return Code: 0 - If the assertion succeeds

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName ... - Required. File. One ore more file which should be zero bytes in size.

Examples

assertZeroFileSize .config
assertZeroFileSize /var/www/log/error.log

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.

assertNotZeroFileSize

Assert a file is non-empty (non-zero sized)

Usage

assertNotZeroFileSize [ fileName ... ]

Assert a file is non-empty (non-zero sized)

Return Code: 1 - If the assertions fails Return Code: 0 - If the assertion succeeds

Arguments

  • --help - Optional. Flag. Display this help.
  • --line lineNumber - Optional. Integer. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Optional. Integer. The depth in the stack of function calls to find the line number of the calling function.
  • --debug - Optional. Flag. Debugging enabled for the assertion function.
  • --debug-lines - Optional. Flag. Debugging of SOLELY differences between --line passed in and the computed line from the --line-depth parameter.
  • --display - Optional. String. Display name for the condition.
  • --success - Optional. Boolean. Whether the assertion should pass (true) or fail (false) - most functions have this already baked in.
  • --stderr-match - Optional. String. One or more strings which must match stderr output. Implies --stderr-ok
  • --stdout-no-match - Optional. String. One or more strings which must match NOT stderr output.
  • --stdout-match - Optional. String. One or more strings which must match stdout output.
  • --stdout-no-match - Optional. String. One or more strings which must match stdout output.
  • --stderr-ok - Optional. Flag. Output to stderr will not cause the test to fail.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals.
  • --skip-plumber - Optional. Flag. Skip plumber check for function calls.
  • --dump - Optional. Flag. Output stderr and stdout after test regardless.
  • --dump-binary - Optional. Flag. Output stderr and stdout after test regardless, displayed as binary.
  • --head - Optional. Flag. When outputting stderr or stdout, output the head of the file.
  • --tail - Optional. Flag. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName ... - Required. File. One ore more file which should NOT be zero bytes in size.

Examples

assertNotZeroFileSize 22 .config
assertNotZeroFileSize 0 .env

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • If the file does not exist, this will fail.