aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ifcreate
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ifcreate')
-rw-r--r--tests/ifcreate/a.do11
-rw-r--r--tests/ifcreate/all.do17
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/ifcreate/a.do b/tests/ifcreate/a.do
new file mode 100644
index 0000000..7f58ce4
--- /dev/null
+++ b/tests/ifcreate/a.do
@@ -0,0 +1,11 @@
+
+if [ -e b ]; then
+ echo -n "b" | cat - a > $3
+else
+ redo-ifcreate b
+ if [ -e a ]; then
+ echo -n "a" | cat - a > $3
+ else
+ echo "a" > $3
+ fi
+fi
diff --git a/tests/ifcreate/all.do b/tests/ifcreate/all.do
new file mode 100644
index 0000000..93fdaf9
--- /dev/null
+++ b/tests/ifcreate/all.do
@@ -0,0 +1,17 @@
+. ../include.sh
+
+rm -rf a b
+
+# we use redo here, as redo-ifchange is smart enough not to rebuild the same
+# file twice in the same redo session
+
+redo a
+redo a
+
+touch b
+
+redo a
+
+assert "ifcreate" << !
+[ "$(cat a)" = "baa" ]
+!