PageRenderTime 46ms CodeModel.GetById 17ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 0ms

/test/art/run.sh

http://txt2tags.googlecode.com/
Shell | 113 lines | 91 code | 17 blank | 5 comment | 8 complexity | 45bb22b87c640a57d5243719ad426833 MD5 | raw file
  1#!/bin/bash
  2# 2010-08-06 Aurelio Jargas
  3#
  4# Quick and dirty tests for Ascii Art Text target.
  5# NOT integrated into main test suite, you must run it alone.
  6
  7cd $(dirname "$0")
  8
  9echo
 10echo "Running txt2tags"
 11
 12t2t="../../txt2tags --no-rc"
 13
 14$t2t -i sample.t2t -t aat                                   -o default.aat
 15$t2t -i sample.t2t -t aat --slides --width 80               -o slides.aat
 16$t2t -i sample.t2t -t aat --slides --width 60               -o slides-60.aat
 17$t2t -i sample.t2t -t aat --slides --width 60 --height 30   -o slides-60.30.aat
 18$t2t -i sample.t2t -t aat --toc                             -o toc.aat
 19$t2t -i sample.t2t -t aat --toc --slides --width 60         -o toc-slide.aat
 20$t2t -i sample.t2t -t aat --toc-only                        -o toc-only.aat
 21$t2t -i sample.t2t -t aat --toc-only --slides --width 60    -o toc-only-slides.aat
 22
 23$t2t -i sample.t2t -t aat --no-headers                                   -o default-no-headers.aat
 24$t2t -i sample.t2t -t aat --no-headers --slides --width 60               -o slides-60-no-headers.aat
 25$t2t -i sample.t2t -t aat --no-headers --toc                             -o toc-no-headers.aat
 26$t2t -i sample.t2t -t aat --no-headers --toc --slides --width 60         -o toc-slide-no-headers.aat
 27
 28$t2t -i toc-macro.t2t -t aat --width 60                     -o no-toc-macro.aat
 29$t2t -i toc-macro.t2t -t aat --toc --width 60 --toc-title "My Own TOC, the title 1 above is not"   -o toc-macro.aat
 30$t2t -i toc-macro.t2t -t aat --slides --width 60            -o no-toc-macro-slides.aat
 31$t2t -i toc-macro.t2t -t aat --toc --slides --width 60      -o toc-macro-slides.aat
 32
 33errors=0
 34for file in *.aat
 35do
 36	if ! test -f ok/$file
 37	then
 38		echo "File not found: ok/$file (test skipped)"
 39		continue
 40	fi
 41	
 42	differences=$(diff $file ok/$file)
 43	if test -z "$differences"
 44	then
 45		rm $file
 46	else
 47		errors=1
 48	fi
 49done
 50
 51if test $errors -eq 0
 52then
 53	echo
 54	echo "All files are OK"
 55else
 56	echo
 57	echo "Found errors here (compare with 'ok' folder):"
 58	ls -1 *.aat
 59fi
 60
 61echo
 62echo
 63echo "Running txt2tagslite"
 64
 65t2tlite="../../txt2tagslite --no-rc"
 66
 67$t2tlite -i sample.t2t -t aat                                   -o default.txt
 68$t2tlite -i sample.t2t -t aap          --width 80               -o slides.txt
 69$t2tlite -i sample.t2t -t aap          --width 60               -o slides-60.txt
 70$t2tlite -i sample.t2t -t aap          --width 60 --height 30   -o slides-60.30.txt
 71$t2tlite -i sample.t2t -t aat --toc                             -o toc.txt
 72$t2tlite -i sample.t2t -t aap --toc          --width 60         -o toc-slide.txt
 73$t2tlite -i sample.t2t -t aat --toc-only                        -o toc-only.txt
 74$t2tlite -i sample.t2t -t aap --toc-only          --width 60    -o toc-only-slides.txt
 75
 76$t2tlite -i sample.t2t -t aat --no-headers                                   -o default-no-headers.txt
 77$t2tlite -i sample.t2t -t aap --no-headers          --width 60               -o slides-60-no-headers.txt
 78$t2tlite -i sample.t2t -t aat --no-headers --toc                             -o toc-no-headers.txt
 79$t2tlite -i sample.t2t -t aap --no-headers --toc          --width 60         -o toc-slide-no-headers.txt
 80
 81$t2tlite -i toc-macro.t2t -t aat --width 60                     -o no-toc-macro.txt
 82$t2tlite -i toc-macro.t2t -t aat --toc --width 60 --toc-title "My Own TOC, the title 1 above is not"   -o toc-macro.txt
 83$t2tlite -i toc-macro.t2t -t aap          --width 60            -o no-toc-macro-slides.txt
 84$t2tlite -i toc-macro.t2t -t aap --toc          --width 60      -o toc-macro-slides.txt
 85
 86errors=0
 87for file in *.txt
 88do
 89        fileok=${file:0:-3}aat
 90	if ! test -f ok/$fileok
 91	then
 92		echo "File not found: ok/$fileok (test skipped)"
 93		continue
 94	fi
 95	
 96	differences=$(diff $file ok/$fileok)
 97	if test -z "$differences"
 98	then
 99		rm $file
100	else
101		errors=1
102	fi
103done
104
105if test $errors -eq 0
106then
107	echo
108	echo "All files are OK"
109else
110	echo
111	echo "Found errors here (compare with 'ok' folder):"
112	ls -1 *.txt
113fi