#!/bin/sh

TEST="that directory inclusion works with files"

testdir=`dirname $0`
. $testdir/testlib

mkdir $work/include.d
if test $? -ne 0 ; then no_result; fi

cat > $work/include.d/foo <<EOF
dport pants
EOF

cat > $work/include.d/bar <<EOF
dest unknown
EOF

cat >$work/in <<EOF
include $work/include.d
EOF
if test $? -ne 0 ; then no_result; fi

$here/scan < $work/in > $work/out 2>&1
if test $? -ne 0 ; then fail ; fi

# can't compare this against a known good output because ordering
# on the disk, and the way opendir()/readdir() iterates over dirents
# isn't guaranteed
# so grep for each file and make sure they got included
grep -q 'include.d/bar' $work/out && \
    grep -q 'include.d/foo' $work/out && \
	pass

# didn't match?
fail
