aboutsummaryrefslogtreecommitdiff
path: root/test/T280-from-guessing.sh
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2015-08-06 12:13:36 +0300
committerDavid Bremner <david@tethera.net>2015-08-07 21:56:39 +0200
commit02a2eeb427d6b424029f6e5e5ddad4c6ec987741 (patch)
treeabdc66ca743a1f21c70238e4c118a51d08c253f1 /test/T280-from-guessing.sh
parentaf3eba97fde00d6bc922df87732b3d28f717f120 (diff)
test: make script exit (1) if it "fails" to source (.) a file
The files (test) scripts source (with builtin command `.`) provides information which the scripts depend, and without the `source` to succeed allowing script to continue may lead to dangerous situations (e.g. rm -rf "${undefined_variable}"/*). At the end of all source (.) lines construct ' || exit 1' was added; In our case the script script will exit if it cannot find (or read) the file to be sourced. Additionally script would also exits if the last command of the sourced file exited nonzero.
Diffstat (limited to 'test/T280-from-guessing.sh')
-rwxr-xr-xtest/T280-from-guessing.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/T280-from-guessing.sh b/test/T280-from-guessing.sh
index 6dfaa40a..7c562fb9 100755
--- a/test/T280-from-guessing.sh
+++ b/test/T280-from-guessing.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="From line heuristics (with multiple configured addresses)"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \