Files
nuweb/test/00/t0022a.sh

112 lines
2.3 KiB
Bash

#!/bin/sh
#
# $RCSfile: t0022a.sh,v $-- Test test/00/t0022a.sh
#
#
# Test that missing includes don't bomb
#
work=${TMPDIR:-/tmp}/$$
PAGER=cat
export PAGER
umask 022
here=`pwd`
if test $? -ne 0 ; then exit 2; fi
SHELL=/bin/sh
export SHELL
bin="$here/${1-.}"
pass()
{
set +x
cd $here
rm -rf $work
exit 0
}
fail()
{
set +x
echo "FAILED test that missing includes don't bomb" 1>&2
cd $here
rm -rf $work
exit 1
}
no_result()
{
set +x
echo "NO RESULT for test that missing includes don't bomb" 1>&2
cd $here
rm -rf $work
exit 2
}
trap \"no_result\" 1 2 3 15
mkdir $work
if test $? -ne 0 ; then no_result; fi
cd $work
if test $? -ne 0 ; then no_result; fi
#
# test ???
#
cat > test.w <<"EOF"
\documentclass{article}
\begin{document}
Here follows a file that exists.
@i exist.w
Here follows a file that doesn't exist.
@i non-exist.w
No more files.
\end{document}
EOF
cat >exist.w <<"EOF"
Here is the existing file.
EOF
cat > test.expected.tex <<"EOF"
\newcommand{\NWtarget}[2]{#2}
\newcommand{\NWlink}[2]{#2}
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
\newcommand{\NWtxtDefBy}{Defined by}
\newcommand{\NWtxtRefIn}{Referenced in}
\newcommand{\NWtxtNoRef}{Not referenced}
\newcommand{\NWtxtFileDefBy}{File defined by}
\newcommand{\NWtxtIdentsUsed}{Uses:}
\newcommand{\NWtxtIdentsNotUsed}{Never used}
\newcommand{\NWtxtIdentsDefed}{Defines:}
\newcommand{\NWsep}{${\diamond}$}
\newcommand{\NWnotglobal}{(not defined globally)}
\newcommand{\NWuseHyperlinks}{}
\documentclass{article}
\begin{document}
Here follows a file that exists.
Here is the existing file.
Here follows a file that doesn't exist.
No more files.
\end{document}
EOF
# [Add other files here. Avoid any extra processing such as
# decompression until after demo has run. If demo fails this script
# can save time by not decompressing. ]
$bin/nuweb test.w
if test $? -ne 0 ; then fail; fi
diff -a --context test.expected.tex test.tex
if test $? -ne 0 ; then fail; fi
# created above to be decompressed, decompress them here ; this saves
# time if demo fails or the text-based sub-test fails.]
#
# Only definite negatives are possible.
# The functionality exercised by this test appears to work,
# no other guarantees are made.
#
pass