diff options
author | Tharre <tharre3@gmail.com> | 2016-06-25 07:24:32 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2016-06-25 07:24:32 +0200 |
commit | ca3cb1fd17adb1ec8c86372cd11333f6e345e013 (patch) | |
tree | 3fd4cf768d1c1cdcb7d3f323aef58774a4a3eccd /tests | |
parent | a431a42262d146dd29270d0550ec89221daf9001 (diff) | |
download | redo-ca3cb1fd17adb1ec8c86372cd11333f6e345e013.tar.gz redo-ca3cb1fd17adb1ec8c86372cd11333f6e345e013.tar.xz redo-ca3cb1fd17adb1ec8c86372cd11333f6e345e013.zip |
Add various tests
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/t0002-fail.t | 11 | ||||
-rwxr-xr-x | tests/t0100-redo.t | 29 |
2 files changed, 38 insertions, 2 deletions
diff --git a/tests/t0002-fail.t b/tests/t0002-fail.t index c8ed4a2..58bf019 100755 --- a/tests/t0002-fail.t +++ b/tests/t0002-fail.t @@ -1,5 +1,5 @@ #!/bin/sh -e -# Copyright (c) 2015 Tharre +# Copyright (c) 2015-2016 Tharre # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. @@ -14,10 +14,19 @@ echo "fail" > $3 exit 1 EOF +cat > "chain_fail.do" <<'EOF' +#!/bin/sh -e +redo-ifchange fail +EOF + test_expect_success "return nonzero" " test_must_fail redo fail " +test_expect_success "return nonzero when dependency failed" " + test_must_fail redo chain_fail +" + test_expect_success "target file was not created" " test_must_fail test -e fail " diff --git a/tests/t0100-redo.t b/tests/t0100-redo.t index f830580..b0bad3d 100755 --- a/tests/t0100-redo.t +++ b/tests/t0100-redo.t @@ -1,5 +1,5 @@ #!/bin/sh -e -# Copyright (c) 2015 Tharre +# Copyright (c) 2015-2016 Tharre # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. @@ -8,4 +8,31 @@ test_description='Redo tests' . ./sharness.sh +cat > "a.do" <<'EOF' +#!/bin/sh -e +redo-ifchange b +echo "a" | cat - b > $3 +EOF + +cat > "b.do" <<'EOF' +#!/bin/sh -e +redo-ifchange c +[ -e "b" ] && exit 1 +echo "b" | cat - c > $3 +EOF + +cat > "c.do" <<'EOF' +#!/bin/sh -e +redo-ifchange s +echo "c" > $3 +EOF + +test_expect_success "redo shortcuts" " + echo "s1" > s && + redo a && + sleep 1 && # TODO: remove this as soon as REDO_MAGIC is fixed + echo "s2" > s && + redo a +" + test_done |