Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / externals / figlet / run-tests.sh
blob4c373ec8d01f6e4afda360c6f945a5cf92fb68d3
1 #!/bin/sh
3 LC_ALL=POSIX
4 export LC_ALL
6 TESTDIR=tests
7 OUTPUT=.test-output.txt
8 LOGFILE=tests.log
9 CMD="./figlet"
10 FONTDIR="$1"
12 run_test() {
13 test_dsc=$1
14 test_cmd=$2
16 total=`expr $total + 1`
17 test_num=`printf %03d $total`
19 echo >> $LOGFILE
20 printf "Run test $test_num: ${test_dsc}... " | tee -a $LOGFILE
21 echo >> $LOGFILE
22 echo "Command: $test_cmd" >> $LOGFILE
23 eval "$test_cmd" > "$OUTPUT" 2>> $LOGFILE
24 cmp "$OUTPUT" "tests/res${test_num}.txt" >> $LOGFILE 2>&1
25 if [ $? -eq 0 ]; then
26 echo "pass" | tee -a $LOGFILE
27 else
28 echo "**fail**" | tee -a $LOGFILE
29 result=1
30 fail=`expr $fail + 1`
34 result=0
35 fail=0
36 $CMD -v > $LOGFILE
38 file="$TESTDIR/input.txt"
39 cmd="cat $file|$CMD"
41 printf "Default font dir: "; $CMD -I2
42 if [ -n "$FONTDIR" ]; then
43 FIGLET_FONTDIR="$FONTDIR"
44 export FIGLET_FONTDIR
46 printf "Current font dir: "; $CMD -I2
47 printf "Default font: "; $CMD -I3
48 $CMD -f small "Test results" | tee -a $LOGFILE
50 total=0
52 run_test "showfigfonts output" "./showfigfonts"
53 run_test "text rendering in all fonts" \
54 "for i in fonts/*.flf; do $cmd -f \$i; done"
55 run_test "long text rendering" "cat tests/longtext.txt|$CMD"
56 run_test "left-to-right text" "$cmd -L"
57 run_test "right-to-left text" "$cmd -R"
58 run_test "flush-left justification" "$cmd -l"
59 run_test "flush-right justification" "$cmd -r"
60 run_test "center justification" "$cmd -c"
61 run_test "kerning mode" "$cmd -k"
62 run_test "full width mode" "$cmd -W"
63 run_test "overlap mode" "$cmd -o"
64 run_test "tlf2 font rendering" "$cmd -f tests/emboss"
65 run_test "kerning flush-left right-to-left mode" "$cmd -klR"
66 run_test "kerning centered right-to-left mode (slant)" "$cmd -kcR -f slant"
67 run_test "full-width flush-right right-to-left mode" "$cmd -WrR"
68 run_test "overlap flush-right mode (big)" "$cmd -or -f big"
69 run_test "tlf2 kerning flush-right mode" "$cmd -kr -f tests/emboss"
70 run_test "tlf2 overlap centered mode" "$cmd -oc -f tests/emboss"
71 run_test "tlf2 full-width flush-left right-to-left mode" \
72 "$cmd -WRl -f tests/emboss"
73 run_test "specify font directory" \
74 "X=.t;mkdir \$X;cp fonts/script.flf \$X/foo.flf;$cmd -d\$X -ffoo;rm -Rf \$X"
75 run_test "paragraph mode long line output" "$cmd -p -w250"
76 run_test "short line output" "$cmd -w5"
77 run_test "kerning paragraph centered mode (small)" "$cmd -kpc -fsmall"
78 run_test "list of control files" "ls fonts/*flc"
79 run_test "uskata control file" "printf 'ABCDE'|$CMD -fbanner -Cuskata"
80 run_test "jis0201 control file" "printf '\261\262\263\264\265'|$CMD -fbanner -Cjis0201"
81 run_test "right-to-left smushing with JavE font" "$cmd -f tests/flowerpower -R"
83 rm -f "$OUTPUT"
85 echo
86 if [ $result -ne 0 ]; then
87 echo " $fail tests failed. See $LOGFILE for result details"
88 else
89 echo " All tests passed."
92 exit $result