Skip to content

Assert Tools

🛠️ Tools · ⬅ Home


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 ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Assert two strings are equal. If this fails it will output an error and exit.

Arguments

  • expected - String. Required. Expected string.
  • actual - String. Required. Actual string
  • message ... - String. Optional. Message to output if the assertion fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

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

Return codes

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

Review Status

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

assertNotEquals

Assert two strings are not equal

Usage

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

Assert two strings are not equal. If this fails it will output an error and exit.

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • expected - String. 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.sh, function assertNotEquals was reviewed 2023-11-12 .

assertContains

Assert one string contains another (case-sensitive)

Usage

assertContains [ needle ] [ haystack ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Assert one string contains another (case-sensitive)

Arguments

  • needle - String. Text we are looking for.
  • haystack ... - String. One or more strings to findneedlein - it must be found in all haystacks.
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - The assertion succeeded
  • 1 - Assertion failed
  • 2 - Bad arguments

assertNotContains

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

Usage

assertNotContains [ needle ] [ haystack ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

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

Arguments

  • needle - String. Text we are looking for.
  • haystack ... - String. One or more strings to findneedlein - it must be found in no haystacks.
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - The assertion succeeded
  • 1 - Assertion failed
  • 2 - Bad arguments

Empty String

assertStringEmpty

Assert a string is empty.

Usage

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

Assert a string is empty. If this fails it will output an error and exit.

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • string ... - Empty strings

Examples

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

Return codes

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

Review Status

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

assertStringNotEmpty

Assert a string is non-empty.

Usage

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

Assert a string is non-empty. If this fails it will output an error and exit.

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. 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.sh, function assertStringNotEmpty was reviewed 2023-11-12 .

Comparison

assertGreaterThan

Assert leftValue > rightValue

Usage

assertGreaterThan [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] leftValue rightValue [ message ]

Assert leftValue > rightValue

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Integer. Required. Value to compare on the left hand side of the comparison
  • rightValue - Integer. Required. 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.sh, function assertGreaterThan was reviewed 2023-11-14 .

assertGreaterThanOrEqual

Assert actual value is greater than or equal to expected value

Usage

assertGreaterThanOrEqual [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] leftValue rightValue [ message ]

Assert leftValue >= rightValue

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Integer. Required. Value to compare on the left hand side of the comparison
  • rightValue - Integer. Required. 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.sh, function assertGreaterThanOrEqual was reviewed 2023-11-12 .

assertLessThan

Assert leftValue < rightValue

Usage

assertLessThan [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] leftValue rightValue [ message ]

Assert leftValue < rightValue

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Integer. Required. Value to compare on the left hand side of the comparison
  • rightValue - Integer. Required. 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 - expected less than to actual
  • 1 - expected greater than or equal to actual, or invalid numbers

Review Status

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

assertLessThanOrEqual

Assert leftValue <= rightValue

Usage

assertLessThanOrEqual [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] leftValue rightValue [ message ]

Assert leftValue <= rightValue

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • leftValue - Integer. Required. Value to compare on the left hand side of the comparison
  • rightValue - Integer. Required. 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 - expected less than or equal to actual
  • 1 - expected greater than actual, or invalid numbers

Review Status

File bin/build/tools/test.sh, function assertLessThanOrEqual was reviewed 2026-02-02 .

Exit code

assertExitCode

Assert a process runs and exits with the correct exit

Usage

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

Assert a process runs and exits with the correct exit code. If this fails it will output an error and exit.

Arguments

  • expectedExitCode - UnsignedInteger. Required. A numeric exit code expected from the command.
  • command - Callable. Required. The command to run
  • arguments - Arguments. Optional. Any arguments to pass to the command to run
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - If the process exits with the provided exit code
  • 1 - If the process exits with a different exit code

Review Status

File bin/build/tools/test.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 ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --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.

Arguments

  • expectedExitCode - UnsignedInteger. A numeric exit code not expected from the command.
  • command - Callable. The command to run
  • arguments - Arguments. Optional. Any arguments to pass to the command to run
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - If the process exits with a different exit code
  • 1 - If the process exits with the provided exit code

Review Status

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

Output

assertOutputEquals

Assert output of a binary equals a string

Usage

assertOutputEquals [ expected ] binary [ ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Assert output of a binary equals a string If this fails it will output an error and exit.

Arguments

  • expected - EmptyString. Expected string to match output.
  • binary - Callable. Required. Binary to run and evaluate output
  • ... - Arguments. Optional. Any additional arguments to binary.
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

assertOutputEquals "2023" date +%Y

Return codes

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

Review Status

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

assertOutputContains

Run a command and expect the output to contain the

Usage

assertOutputContains expected binary [ ... ] [ --exit ] [ --stderr ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

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.

Arguments

  • expected - String. Required. A string to expect in the output
  • binary - Callable. Required. Binary to run and evaluate output
  • ... - Arguments. Optional. Any additional arguments to binary.
  • --exit - Assert exit status of process to be this number
  • --stderr - Also include standard error in output checking
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

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

Return codes

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

Review Status

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

assertOutputDoesNotContain

Run a command and expect the output to not contain

Usage

assertOutputDoesNotContain expected binary [ ... ] [ --exit ] [ --stderr ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

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.

Arguments

  • expected - String. Required. A string NOT to expect in the output
  • binary - Callable. Required. Binary to run and evaluate output
  • ... - Arguments. Optional. Any additional arguments to binary.
  • --exit - Assert exit status of process to be this number
  • --stderr - Also include standard error in output checking
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

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

Return codes

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

Review Status

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

Directory

assertDirectoryExists

Test that a directory exists

Usage

assertDirectoryExists directory [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a directory exists

Arguments

  • directory - Directory. Required. Directory that should exist
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

    • This fails if directory is anything but a directory

assertDirectoryDoesNotExist

Test that a directory does not exist

Usage

assertDirectoryDoesNotExist directory [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a directory does not exist

Arguments

  • directory - Directory. Required. Directory that should NOT exist
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

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

Review Status

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

assertDirectoryEmpty

Test that a directory exists

Usage

assertDirectoryEmpty [ directory ] [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a directory exists

Arguments

  • directory - Directory. Directory that should exist and be empty
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

    • This fails if directory is anything but a directory

assertDirectoryNotEmpty

Test that a directory does not exist

Usage

assertDirectoryNotEmpty [ directory ] [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a directory does not exist

Arguments

  • directory - Directory. Directory that should exist and not be empty
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Review Status

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

File

assertFileExists

Test that a file exists

Usage

assertFileExists item [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a file exists

Arguments

  • item - File. Required. File that should exist
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

assertDirectoryExists "$HOME" "HOME not found"

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

    • This fails if file is anything but a file

assertFileDoesNotExist

Test that a file does not exist

Usage

assertFileDoesNotExist item [ message ... ] [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Test that a file does not exist

Arguments

  • item - String. Required. File that should NOT exist
  • message ... - String. Optional. An error message if this fails
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

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

Review Status

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

assertFileContains

Assert a file contains one or more strings

Usage

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

Assert a file contains one or more strings

Arguments

  • fileName - File. Required. File to search
  • string ... - String. Required. One or more strings which must be found on at least one line in the file
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

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

Return codes

  • 0 - If the assertion succeeds
  • 1 - If the assertion fails

Environment

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

Review Status

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

assertFileDoesNotContain

Assert a file does not contains any occurrence of one

Usage

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

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

Arguments

  • fileName - File. Required. File to search
  • string ... - String. Required. One or more strings which must NOT be found anywhere in fileName
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

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

Return codes

  • 1 - If the assertions fails
  • 0 - If the assertion succeeds

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 ... [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ]

Assert a file has an expected size in bytes

Arguments

  • expectedSize - PositiveInteger. Required. Integer file size which fileName should be, in bytes.
  • fileName ... - File. Required. One ore more file which should be expectedSize bytes in size.
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)

Examples

assertFileSize 22 .config
assertFileSize 0 .env

Return codes

  • 1 - If the assertions fails
  • 0 - If the assertion succeeds

Environment

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

assertNotFileSize

Assert a file does NOT have an expected size in

Usage

assertNotFileSize [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] expectedSize fileName ...

Assert a file does NOT have an expected size in bytes

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • expectedSize - PositiveInteger. Required. Integer file size which fileName should NOT be, in bytes.
  • fileName ... - File. Required. One ore more file which should NOT be expectedSize bytes in size.

Examples

assertNotFileSize 22 .config
assertNotFileSize 0 .env

Return codes

  • 1 - If the assertions fails
  • 0 - If the assertion succeeds

Environment

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

assertZeroFileSize

Assert a file is empty (zero sized)

Usage

assertZeroFileSize [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] - fileName ...

Assert a file is empty (zero sized)

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName ... - File. Required. One ore more file which should be zero bytes in size.

Examples

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

Return codes

  • 1 - If the assertions fails
  • 0 - If the assertion succeeds

Environment

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

assertNotZeroFileSize

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

Usage

assertNotZeroFileSize [ --help ] [ --handler handler ] [ --display ] [ --debug ] [ --line lineNumber ] [ --line-depth depth ] [ --stdout-match ] [ --stdout-no-match ] [ --stderr-ok ] [ --stderr-match ] [ --stderr-no-match ] [ --dump ] [ --dump-binary ] [ --plumber ] [ --leak globalName ] [ --skip-plumber ] [ --head ] [ --tail ] - fileName ...

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

Arguments

  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • --display - String. Optional. Display name for the condition.
  • --debug - Flag. Optional. Debugging enabled for the assertion function.
  • --line lineNumber - Integer. Optional. Line number of calling function. Typically this is not required as it is computed from the calling function using --line-depth.
  • --line-depth depth - Integer. Optional. The depth in the stack of function calls to find the line number of the calling function.
  • --stdout-match - String. Optional. One or more strings which must match stdout output.
  • --stdout-no-match - String. Optional. One or more strings which must match stdout output.
  • --stderr-ok - Flag. Optional. Output to stderr will not cause the test to fail.
  • --stderr-match - String. Optional. One or more strings which must match stderr output. Implies --stderr-ok
  • --stderr-no-match - String. Optional. One or more strings which must match NOT stderr output. Implies --stderr-ok
  • --dump - Flag. Optional. Output stderr and stdout after test regardless.
  • --dump-binary - Flag. Optional. Output stderr and stdout after test regardless, displayed as binary.
  • --plumber - Flag. Optional. Wrap the test call with the plumber call to detect local leaks.
  • --leak globalName - Zero or more. String. Allow global leaks for these globals when --plumber is enabled.
  • --skip-plumber - Flag. Optional. Skip plumber check for function calls. When specified with --plumber the last occurrence on the command line is effective.
  • --head - Flag. Optional. When outputting stderr or stdout, output the head of the file.
  • --tail - Flag. Optional. When outputting stderr or stdout, output the tail of the file. (Default)
  • fileName ... - File. Required. One ore more file which should NOT be zero bytes in size.

Examples

assertNotZeroFileSize 22 .config
assertNotZeroFileSize 0 .env

Return codes

  • 1 - If the assertions fails
  • 0 - If the assertion succeeds

Environment

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

Test Mocking help

mockEnvironmentStart

Fake a value for testing

Usage

mockEnvironmentStart globalName [ value ] [ ... ] [ --help ]

Fake a value for testing

Arguments

  • globalName - EnvironmentVariable. Required. Global to change temporarily to a value.
  • value - EmptyString. Optional. Force the value of globalName to this value temporarily. Saves the original value.
  • ... - Continue passing pairs of globalName value to mock additional values.
  • --help - Flag. Optional. Display this help.

Return codes

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

mockEnvironmentStop

Restore a mocked value. Works solely with the default saveGlobalName

Arguments

  • globalName ... - EnvironmentVariable. Required. Global to restore from the mocked saved value.
  • --help - Flag. Optional. Display this help.

Return codes

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

mockConsoleAnimationStart

Fake consoleHasAnimation for testing

Usage

mockConsoleAnimationStart [ true | false ] [ --help ]

Fake consoleHasAnimation for testing

Arguments

  • true |- false - Boolean. Force the value of consoleHasAnimation to this value temporarily. Saves the original value.
  • --help - Flag. Optional. Display this help.

Return codes

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

mockConsoleAnimationStop

Stop faking consoleHasAnimation for testing

Usage

mockConsoleAnimationStop [ --help ]

Stop faking consoleHasAnimation for testing

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

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

Assert return code

returnAssert

Assertion return code

Usage

returnAssert

Return code is assert

Arguments

  • none

Return codes

  • 97

returnIdentical

Identical return code

Usage

returnIdentical

Return code is identical

Arguments

  • none

Return codes

  • 105

returnLeak

Leak return code

Usage

returnLeak

Return code is leak

Arguments

  • none

Return codes

  • 108