diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-08-03 11:16:57 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-08-03 11:16:57 +0200 |
commit | c44d20b642523c14a77e3f3c316a1d6cf1df7340 (patch) | |
tree | 40a8a49f49a4793c72ac988628504e65b81059fc | |
parent | e9432fe394e880d6eef93e834217f3e52e8139ab (diff) | |
download | pinentry-rofi-c44d20b642523c14a77e3f3c316a1d6cf1df7340.tar.gz |
Basic testing infrastructure established.
-rw-r--r-- | tests/foundational.bats | 11 | ||||
-rw-r--r-- | tests/utils.bats | 18 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/foundational.bats b/tests/foundational.bats new file mode 100644 index 0000000..5683371 --- /dev/null +++ b/tests/foundational.bats @@ -0,0 +1,11 @@ +#!/usr/bin/env bats + +@test "addition using bc" { + result="$(echo 2+2 | bc)" + [ "$result" -eq 4 ] +} + +@test "addition using dc" { + result="$(echo 2 2+p | dc)" + [ "$result" -eq 4 ] +} diff --git a/tests/utils.bats b/tests/utils.bats new file mode 100644 index 0000000..ab74020 --- /dev/null +++ b/tests/utils.bats @@ -0,0 +1,18 @@ +#!/usr/bin/env bats + +setup() { + # get the containing directory of this file + # use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0, + # as those will point to the bats executable's location or the preprocessed file respectively + DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" + source "$(readlink -f "$DIR/../pinentry-rofi.sh")" +} + +@test "succesful setup" { + : +} + +@test "converting Assuan protocol errors: 0" { + result="$(assuan_result 0)" + [ "$result" == "ERR 0 no error" ] +} |