Skip to content

Commit

Permalink
Update test files
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 7, 2020
1 parent 17bd251 commit f414e98
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build/

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
!testbst/**/*.bbl
!test/**/*.bbl
*.bcf
*.blg
*-blx.aux
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ TEXOPTS = -file-line-error -halt-on-error -interaction=nonstopmode
LATEXMK = latexmk -xelatex $(TEXOPTS)

testbst : bst
bash test/check.sh
bash test/test.sh

test: testbst
l3build check

save :
savebst:
bash test/save.sh

save : savebst
l3build save --quiet super
l3build save --quiet numbers
l3build save --quiet authoryear
Expand Down
54 changes: 0 additions & 54 deletions test/check.sh

This file was deleted.

2 changes: 1 addition & 1 deletion test/save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for file in $testfiledir/*.dtx; do

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile"; then
if ! diff -q "$bblfile" "$stdfile" 2> /dev/null; then
cp -f "$bblfile" "$stdfile";
fi
done
77 changes: 77 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
testfiledir="test/testbst"
testsuppdir="$testfiledir/support"
unpackdir="build/unpacked";
testdir="build/test";
texoptions="-file-line-error -halt-on-error -interaction=nonstopmode"
unpackexe="xetex $texoptions"
checkexe="xelatex $texoptions -no-pdf"
bibtexexe="bibtex"


if [ ! -d "$unpackdir" ]; then
mkdir -p "$unpackdir";
fi
cp -f "gbt7714.dtx" "$unpackdir";


if [ ! -d "$testdir" ]; then
mkdir -p "$testdir";
fi
cp -f "$testfiledir/support/test.aux" "$testdir";
cp -f "$testfiledir/support/standard.bib" "$testdir";


if [ -z "$1" ]; then
succuss=true;
echo "Running checks on";

for file in $testfiledir/*.dtx; do
filename=$(basename $file);
testname=$(basename $filename .dtx);
echo " $testname";

cp -f "$file" "$unpackdir"; # test bib file

( cd "$unpackdir"; $unpackexe $filename > /dev/null; )
cp -f "$unpackdir/test.bst" "$testdir"
cp -f "$unpackdir/test.bib" "$testdir"

( cd $testdir; $bibtexexe test > /dev/null; )

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile" 2> /dev/null; then
echo "fails";
succuss=false;
fi
done

if $succuss; then
echo "";
echo "All checks passed";
echo "";
else
exit 1;
fi

else
cp -f "$testfiledir/support/test.tex" "$testdir";
cp -f "gbt7714.sty" "$testdir";
testname="$1";
filename="$testname.dtx";
file="$testfiledir/$testname.dtx";

cp -f "$file" "$unpackdir"; # test bib file

( cd "$unpackdir"; $unpackexe $filename > /dev/null; )
cp -f "$unpackdir/test.bst" "$testdir";
cp -f "$unpackdir/test.bib" "$testdir";

( cd "$testdir"; latexmk -xelatex test > /dev/null; )

bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile" > /dev/null; then
cp -f "$bblfile" "$stdfile";
fi
fi
Empty file removed test/testbst/support/cases.bib
Empty file.
15 changes: 15 additions & 0 deletions test/testbst/support/test.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
\documentclass{ctexart}

\usepackage{gbt7714}

\begin{document}

\citestyle{super}

Foo
\nocite{*}

\bibliographystyle{test}
\bibliography{standard,test}

\end{document}

0 comments on commit f414e98

Please sign in to comment.