diff options
author | Kerin Millar <kfm@plushkava.net> | 2023-06-10 08:40:16 +0100 |
---|---|---|
committer | Kerin Millar <kfm@plushkava.net> | 2023-06-10 08:42:07 +0100 |
commit | 7f27dfa0ca0969837a9a40df49281ec7a2dae035 (patch) | |
tree | 393b5a1b6a8e57095e617c47b54145f2995f0786 | |
parent | Fix the order of the arguments used to compose the CUP sequence (diff) | |
download | gentoo-functions-7f27dfa0ca0969837a9a40df49281ec7a2dae035.tar.gz gentoo-functions-7f27dfa0ca0969837a9a40df49281ec7a2dae035.tar.bz2 gentoo-functions-7f27dfa0ca0969837a9a40df49281ec7a2dae035.zip |
test-functions: Add a test for the ebegin() function
The test determines whether ebegin() appends at least one <newline>
character to the message (following the ASCII ellipsis).
Signed-off-by: Kerin Millar <kfm@plushkava.net>
-rwxr-xr-x | test-functions | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test-functions b/test-functions index aed6620..513deb3 100755 --- a/test-functions +++ b/test-functions @@ -68,6 +68,25 @@ test_chdir_noop() { iterate_tests 2 "$@" } +test_ebegin() { + _eprint() { + shift + _ends_with_newline "$*" + ok=$(( $? == 0 )) + } + + ok=0 + set -- "message" + ebegin "$1" + + if [ "${ok}" -eq 0 ]; then + printf 'not ' + fi + printf 'ok %d - ebegin %s (expecting terminating newline)\n' "$((testnum + 1))" "$1" + + return "$(( ok ? 0 : 1 ))" +} + test_is_older_than() { set -- \ 1 N/A N/A \ @@ -451,6 +470,7 @@ rc=0 test_chdir || rc=1 test_chdir_noop || rc=1 +( test_ebegin ) || rc=1; testnum=$((testnum + 1)) test_is_older_than || rc=1 test_get_bootparam || rc=1 test_esyslog || rc=1 |