Read all the available lines from stdin accumulating them into a local variable, separated by
\n
; then compare the input with STRING, or the empty string if STRING is not
present, and return true if they are equal, false otherwise.
The optional argument DESCRIPTION should be a short, one–line, string describing the expected value; it is used in the output text describing the failed comparison.
Example of test for a function that echoes its three parameters:
function my-lib-function () { echo $1 $2 $3 } function mytest-1.1 () { my-lib-function a b c | dotest-output "a b c" } dotest mytest
Example of test for a function that is supposed to print nothing:
function my-lib-function () { test "$1" != "$2" && echo error } function mytest-1.1 () { my-lib-function a a | dotest-output } dotest mytest
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.