pashage

Yet Another Opinionated Re-engineering of the Unix Password Store
git clone https://git.instinctive.eu/pashage.git
Log | Files | Refs | README | LICENSE

commit ad7c45a63946ff1c31b32562bc16b0c5404666b4
parent b7fce20e89f52eb979c0032a8056dfdd47e7428f
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Sat, 14 Sep 2024 08:11:09 +0000

mocklog function is shared across all test files
Diffstat:
Mspec/action_spec.sh | 11-----------
Mspec/spec_helper.sh | 11+++++++++++
Mspec/usage_spec.sh | 11-----------
3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/spec/action_spec.sh b/spec/action_spec.sh @@ -22,17 +22,6 @@ Describe 'Action Functions' Include src/pashage.sh Set 'errexit:on' 'nounset:on' 'pipefail:on' - mocklog() { - if [ $# -eq 1 ]; then - %printf '$ %s\n' "$1" >&2 - else - %printf '$ %s' "$1" >&2 - shift - %printf ' %s' "$@" >&2 - %printf '\n' >&2 - fi - } - Describe 'do_copy_move' DECISION=default OVERWRITE=yes diff --git a/spec/spec_helper.sh b/spec/spec_helper.sh @@ -5,6 +5,17 @@ # so it is better to set them here. # set -eu +mocklog() { + if [ $# -eq 1 ]; then + printf '$ %s\n' "$1" >&2 + else + printf '$ %s' "$1" >&2 + shift + printf ' %s' "$@" >&2 + printf '\n' >&2 + fi +} + # This callback function will be invoked only once before loading specfiles. spec_helper_precheck() { # Available functions: info, warn, error, abort, setenv, unsetenv diff --git a/spec/usage_spec.sh b/spec/usage_spec.sh @@ -35,17 +35,6 @@ Describe 'Command-Line Parsing' SELECTED_LINE=1 SHOW=text - mocklog() { - if [ $# -eq 1 ]; then - %printf '$ %s\n' "$1" >&2 - else - %printf '$ %s' "$1" >&2 - shift - %printf ' %s' "$@" >&2 - %printf '\n' >&2 - fi - } - # mocks platform_tmpdir() { SECURE_TMPDIR=/tmp/secure