Skip to content

Commit

Permalink
Properly handle base help command
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed May 9, 2024
1 parent b50a71c commit 42b7fe7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions utils/e2e-tests/bash/tests/base/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
# the help texts change.

compare() {
COMMAND="${@:-""}"
FIXTURE="help."${COMMAND// /.}".stdout.txt"
SUBCOMMAND="${@:-""}"

echo $FIXTURE
# Replace subcommands spaces by dots to prepare fixture filename.
FIXTURE_FILENAME="help."${SUBCOMMAND// /.}".stdout.txt"
# Avoid having double dots.
FIXTURE_FILENAME=${FIXTURE_FILENAME//../.}

OUTPUT="$("$HUMANODE_PEER_PATH" $COMMAND --help)"
TEMPLATE="$(cat "$SCRIPT_DIR/../../fixtures/$FIXTURE")"
OUTPUT="$("$HUMANODE_PEER_PATH" $SUBCOMMAND --help)"
TEMPLATE="$(cat "$SCRIPT_DIR/../../fixtures/$FIXTURE_FILENAME")"

DIFF_CMD_ARGS=(
-u
Expand All @@ -29,7 +31,8 @@ compare() {
fi
}

COMMANDS=(
SUBCOMMANDS=(
""
"key"
"key generate-node-key"
"key generate"
Expand All @@ -38,8 +41,8 @@ COMMANDS=(
"key insert"
)

for COMMAND in "${COMMANDS[@]}"; do
compare $COMMAND
for SUBCOMMAND in "${SUBCOMMANDS[@]}"; do
compare $SUBCOMMAND
done

printf "Test succeded\n" >&2

0 comments on commit 42b7fe7

Please sign in to comment.