PageRenderTime 27ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/test/outfile/run.sh

http://txt2tags.googlecode.com/
Shell | 89 lines | 68 code | 14 blank | 7 comment | 3 complexity | 7df6166a092b1986fd90abda042435f6 MD5 | raw file
 1#!/bin/bash
 2# 2010-12-03 Aurelio Jargas
 3#
 4# Quick and dirty tests for the outfile path.
 5# NOT integrated into main test suite, you must run it alone.
 6#
 7
 8cd $(dirname "$0")
 9mypath=$PWD
10out="out.txt"
11t2t="$mypath/../../txt2tags --no-rc -t txt -H"
12
13set -e  # Abort if txt2tags returned an error
14
15reset() {
16	rm -f $out folder/$out folder/subfolder/$out.txt
17}
18new() {
19	echo "---- $*"
20}
21check() {
22	if ! test -f "$1"
23	then
24		echo "FAIL! expected $1"
25		exit 1
26	else
27		rm "$1"
28	fi
29}
30
31cd "$mypath"
32
33test -d folder || mkdir folder
34test -d folder/subfolder || mkdir folder/subfolder
35
36reset
37
38new '(1) from current folder'
39$t2t -i current.t2t                             ; check $out
40$t2t -i folder.t2t                              ; check folder/$out
41$t2t -i subfolder.t2t                           ; check folder/subfolder/$out
42$t2t -i folder/folder.t2t                       ; check folder/$out
43$t2t -i folder/subfolder/subfolder.t2t          ; check folder/subfolder/$out
44
45new '(2) from parent folder'
46cd ..
47$t2t -i outfile/current.t2t                     ; check outfile/$out
48$t2t -i outfile/folder.t2t                      ; check outfile/folder/$out
49$t2t -i outfile/subfolder.t2t                   ; check outfile/folder/subfolder/$out
50$t2t -i outfile/folder/folder.t2t               ; check outfile/folder/$out
51$t2t -i outfile/folder/subfolder/subfolder.t2t  ; check outfile/folder/subfolder/$out
52cd outfile
53
54new '(3) from subfolder'
55cd folder/subfolder
56$t2t -i ../../current.t2t                       ; check ../../$out
57$t2t -i ../../folder.t2t                        ; check ../../folder/$out
58$t2t -i ../../subfolder.t2t                     ; check ../../folder/subfolder/$out
59$t2t -i ../../folder/folder.t2t                 ; check ../../folder/$out
60$t2t -i ../../folder/subfolder/subfolder.t2t    ; check ../../folder/subfolder/$out
61cd ../..
62
63new '(4) from current folder using -o'  #  overrides %!option
64$t2t -i folder.t2t                      -o $out ; check $out
65$t2t -i subfolder.t2t                   -o $out ; check $out
66$t2t -i folder/folder.t2t               -o $out ; check $out
67$t2t -i folder/subfolder/subfolder.t2t  -o $out ; check $out
68$t2t -i current.t2t -o folder/$out              ; check folder/$out
69$t2t -i current.t2t -o folder/subfolder/$out    ; check folder/subfolder/$out
70
71new '(5) from parent folder using -o'
72cd ..
73$t2t -i outfile/current.t2t -o outfile/$out        ; check outfile/$out
74$t2t -i outfile/current.t2t -o outfile/folder/$out ; check outfile/folder/$out
75cd outfile
76
77new '(6) from subfolder using -o'
78cd folder/subfolder
79$t2t -i ../../current.t2t -o $out               ; check $out
80$t2t -i ../../current.t2t -o ../$out            ; check ../$out
81$t2t -i ../../current.t2t -o ../../$out         ; check ../../$out
82cd ../../
83
84# If we got here, everything is OK
85
86nr_tests=$(grep 'check ' "$mypath/run.sh" | wc -l | tr -d ' \t')
87echo
88echo Module outfile, $nr_tests tests made.
89echo All files are OK