#!/bin/bash

#   eLyXer -- convert LyX source files to HTML output.
#
#   Copyright (C) 2009 Alex Fernández
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Alex 20090319: run all tests

# first from the current directory
echo "Testing eLyXer -- any text below this line signals an error"
for file in test/*.lyx; do
  name=$(dirname "$file")/$(basename "$file" .lyx)
  ./elyxer.py --quiet "$name.lyx" "$name-test.html"
  diff --ignore-matching-lines="create-date" "$name-test.html" "$name-good.html"
done
# now tests from with the directory
cd test
for file in *.lyx; do
  name=$(basename "$file" .lyx)
  ../elyxer.py --quiet "$name.lyx" "$name-test.html"
  diff --ignore-matching-lines="create-date" "$name-test.html" "$name-good.html"
done
# cleanup
cd ..
rm -f "*-test.html"

