From: alex Date: Fri, 20 May 2022 00:09:49 +0000 (-0700) Subject: ... X-Git-Url: http://git.infiniteadaptability.org/?a=commitdiff_plain;h=1cd364181a9d9fa87b8a7ffda156e91fd74ab7fe;p=cold ... --- diff --git a/test/setup.sh b/test/setup.sh index d2d6a64..14eabda 100644 --- a/test/setup.sh +++ b/test/setup.sh @@ -5,13 +5,15 @@ TEST_DIR=".testdir" source source.sh clean_env() { + bitcoin_core_stop cd .. rm -rf "$TEST_DIR" -} +} > /dev/null 2>&1 setup_env() { mkdir "$TEST_DIR" cd "$TEST_DIR" + bitcoin_core_start } > /dev/null 2>&1 reset_env() { @@ -22,17 +24,16 @@ reset_env() { assert() { if [[ "$1" != "$2" ]]; then echo -e "Expected:\n$1\nResult:\n$2" - echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]} failed" + echo -e "${BASH_SOURCE[1]}:${BASH_LINENO[0]} \e[31mFAILED\e[0m" exit 1 fi } test_failed() { - echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]} failed" + echo -e "${BASH_SOURCE[1]}:${BASH_LINENO[0]} \e[31mFAILED\e[0m" exit 1 } test_succeeded() { - echo "${BASH_SOURCE[1]} succeeded" - clean_env + echo -e "${BASH_SOURCE[1]}: \e[32mSUCCESS\e[0m" } diff --git a/test/wallet_create.tests.sh b/test/wallet_create.tests.sh new file mode 100755 index 0000000..fee78df --- /dev/null +++ b/test/wallet_create.tests.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source setup.sh + +setup_env + +(wallet_create 1 > result 2>&1) +EXPECTED="created wallet: wallet1" +RESULT=$( result 2>&1) +EXPECTED="created wallet: wallet2" +RESULT=$(