]> Cypherpunks.ru repositories - goredo.git/blobdiff - t/goredo-deps.t
Fix dependencies relative paths determination
[goredo.git] / t / goredo-deps.t
diff --git a/t/goredo-deps.t b/t/goredo-deps.t
new file mode 100755 (executable)
index 0000000..a0a58d5
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+testname=`basename "$0"`
+test_description="Check that the following use-case won't rebuild everytime and has correct dependencies"
+. $SHARNESS_TEST_SRCDIR/sharness.sh
+
+tmp=`mktemp -d`
+trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
+cd $tmp
+mkdir -p sub
+cat > default.html.do <<EOF
+redo-ifchange \$2.pre
+echo HTML
+cat \$2.pre
+EOF
+cat > default.pre.do <<EOF
+redo-ifchange *.inc \$2.html.in
+echo PRE
+cat \$2.html.in
+EOF
+echo FOOTER > footer.inc
+echo "<html>" > sub/index.html.in
+
+test_expect_success Build "redo sub/index.html"
+stat1=`stat sub/index.html`
+test_expect_success Rebuild "redo-ifchange sub/index.html"
+stat2=`stat sub/index.html`
+test_expect_success "Was not rebuild" '[ "$stat1" = "$stat2" ]'
+
+tgts=`sed -n "s/^Target: //p" sub/.redo/index.html.dep | sort`
+tgts=`echo $tgts`
+tgts_expected="../default.html.do" # .do itself
+tgts_expected="$tgts_expected default.do" # ifcreate
+tgts_expected="$tgts_expected default.html.do" # ifcreate
+tgts_expected="$tgts_expected index.html" # check for user-modification
+tgts_expected="$tgts_expected index.html.do" # ifcreate
+tgts_expected="$tgts_expected index.pre" # source
+test_expect_success "Correct dependencies" '[ "$tgts" = "$tgts_expected" ]'
+
+test_done