From 8beb7e82ee31eb81a378d92f0a4b239665e9fc57 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 24 Jan 2010 01:47:14 +0000 Subject: [PATCH] Add a test to check that all fonts can be loaded. --- fonts/Makefile.am | 2 ++ test/Makefile.am | 4 ++-- test/check-build | 6 +++++- test/check-fonts | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 test/check-fonts diff --git a/fonts/Makefile.am b/fonts/Makefile.am index 4cd13d0..819b1c1 100644 --- a/fonts/Makefile.am +++ b/fonts/Makefile.am @@ -11,3 +11,5 @@ EXTRA_DIST = $(allfonts) font_DATA = $(allfonts) fontdir = $(datadir)/figlet +echo-fonts: ; echo $(allfonts) + diff --git a/test/Makefile.am b/test/Makefile.am index b2a1bbe..c3a2f94 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,6 @@ # $Id$ -EXTRA_DIST = check-build +EXTRA_DIST = check-build check-fonts -TESTS = check-build +TESTS = check-build check-fonts diff --git a/test/check-build b/test/check-build index 9f515e7..d0c6db1 100755 --- a/test/check-build +++ b/test/check-build @@ -8,7 +8,11 @@ ret=0 failure=0 for dir in src tools; do pushd ../$dir >/dev/null - for x in $(make echo-sources); do + for x in $(make -s echo-sources); do + case "$x" in + *.c|*.cpp|*.h|*.m) ;; + *) continue ;; + esac if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then echo "error: $dir/$x contains trailing spaces" failure=1 diff --git a/test/check-fonts b/test/check-fonts new file mode 100755 index 0000000..d642ee2 --- /dev/null +++ b/test/check-fonts @@ -0,0 +1,34 @@ +#!/bin/sh + +ret=0 + +# +# Check that we have no tabs or trailing spaces in the source code +# +failure=0 +(cd ../fonts + for x in $(make -s echo-fonts); do + case "$x" in + *.tlf|*.flf) ;; + *) continue ;; + esac + echo "Checking font $x..." + if ../src/toilet -d ../fonts -f "$x" Hello World >/dev/null; then + : + else + echo "Error loading font $x" + failure=1 + fi + done) +if test "$failure" != "0"; then + ret=1 +else + echo "0 errors in fonts" +fi + +if test "$ret" != "0"; then + exit 1 +fi + +exit 0 +