]> Cypherpunks.ru repositories - goredo.git/blob - t/goredo-deps.t
mktemp is unnecessary
[goredo.git] / t / goredo-deps.t
1 #!/bin/sh
2
3 testname=`basename "$0"`
4 test_description="Check that the following use-case won't rebuild everytime and has correct dependencies"
5 . $SHARNESS_TEST_SRCDIR/sharness.sh
6
7 mkdir -p sub
8 cat > default.html.do <<EOF
9 redo-ifchange \$2.pre
10 echo HTML
11 cat \$2.pre
12 EOF
13 cat > default.pre.do <<EOF
14 redo-ifchange *.inc \$2.html.in
15 echo PRE
16 cat \$2.html.in
17 EOF
18 echo FOOTER > footer.inc
19 echo "<html>" > sub/index.html.in
20
21 test_expect_success Build "redo sub/index.html"
22 stat1=`stat sub/index.html`
23 test_expect_success Rebuild "redo-ifchange sub/index.html"
24 stat2=`stat sub/index.html`
25 test_expect_success "Was not rebuild" '[ "$stat1" = "$stat2" ]'
26
27 tgts=`sed -n "s/^Target: //p" sub/.redo/index.html.rec | sort`
28 tgts=`echo $tgts`
29 tgts_expected="../default.html.do" # .do itself
30 tgts_expected="$tgts_expected default.do" # ifcreate
31 tgts_expected="$tgts_expected default.html.do" # ifcreate
32 tgts_expected="$tgts_expected index.html" # check for user-modification
33 tgts_expected="$tgts_expected index.html.do" # ifcreate
34 tgts_expected="$tgts_expected index.pre" # source
35 test_expect_success "Correct dependencies" '[ "$tgts" = "$tgts_expected" ]'
36
37 test_done