aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t0002-fail.t
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2015-09-13 22:48:46 +0200
committerTharre <tharre3@gmail.com>2015-09-13 22:48:46 +0200
commit7948ad86578f789cf1c2b92eb9b5c625e26df007 (patch)
tree9d481d63e449d8cb80fc06ac8f58954f16f27ee9 /tests/t0002-fail.t
parent87196f9900974a1ecc7bd5f07768f65dd1eb53e9 (diff)
downloadredo-7948ad86578f789cf1c2b92eb9b5c625e26df007.tar.gz
redo-7948ad86578f789cf1c2b92eb9b5c625e26df007.tar.xz
redo-7948ad86578f789cf1c2b92eb9b5c625e26df007.zip
Add a few tests
Diffstat (limited to 'tests/t0002-fail.t')
-rwxr-xr-xtests/t0002-fail.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/t0002-fail.t b/tests/t0002-fail.t
new file mode 100755
index 0000000..c8ed4a2
--- /dev/null
+++ b/tests/t0002-fail.t
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+# Copyright (c) 2015 Tharre
+#
+# This software may be modified and distributed under the terms
+# of the MIT license. See the LICENSE file for details.
+
+test_description='Abort if do-script returns nonzero'
+
+. ./sharness.sh
+
+cat > "fail.do" <<'EOF'
+#!/bin/sh -e
+echo "fail" > $3
+exit 1
+EOF
+
+test_expect_success "return nonzero" "
+ test_must_fail redo fail
+"
+
+test_expect_success "target file was not created" "
+ test_must_fail test -e fail
+"
+
+test_done