summaryrefslogtreecommitdiffstats
path: root/tests/stateless-journey.sh
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-05-29 16:34:49 +0530
committerSebastian Thiel <sthiel@thoughtworks.com>2019-05-29 16:34:49 +0530
commite9a447250ba9ffd10f94f6f7d970c6da141c185d (patch)
tree1f7cef8b6c5ca783c0e37eae77251ed6e5346e63 /tests/stateless-journey.sh
First instantiation of template
Diffstat (limited to 'tests/stateless-journey.sh')
-rwxr-xr-xtests/stateless-journey.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/stateless-journey.sh b/tests/stateless-journey.sh
new file mode 100755
index 0000000..13b5753
--- /dev/null
+++ b/tests/stateless-journey.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -eu
+
+exe=${1:?First argument must be the executable to test}
+
+root="$(cd "${0%/*}" && pwd)"
+# shellcheck disable=1090
+source "$root/utilities.sh"
+snapshot="$root/snapshots"
+
+SUCCESSFULLY=0
+WITH_FAILURE=1
+
+(with "no input file"
+ it "fails with an error message" && {
+ WITH_SNAPSHOT="$snapshot/failure-missing-input-file" \
+ expect_run ${WITH_FAILURE} "$exe"
+ }
+)
+(with "a valid input file"
+ it "produces the expected output" && {
+ WITH_SNAPSHOT="$snapshot/success-input-file-produces-correct-output" \
+ expect_run ${SUCCESSFULLY} "$exe" <(echo this is probably not what you want)
+ }
+)