Debian Codegraph @

test/cli/core/runner

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 if test -d dist-newstyle ; then
2 HJSMIN=$(find dist-newstyle -type f -name hjsmin)
3 elif test -d ../dist-newstyle ; then
4 HJSMIN=$(find ../dist-newstyle -type f -name hjsmin)
5 fi
6
7 echo
8 echo $HJSMIN
9 echo
10
11 DIFF=${USE_DIFF:-diff -u}
12
13 colourReset='\e[0m'
14 colourGreen='\e[0;32m'
15 colourRed='\e[0;31m'
16 colourYellow='\e[0;33m'
17
18 testname=$(basename $(dirname $0))
19
20 # Failure is the default!
21 RESULT="FAILED"
22
23 type "$HJSMIN" > /dev/null 2>&1 || {
24 echo "No hjsmin executable specified on command line or on path."
25 exit 1
26 }
27
28 ROOT=$(dirname "$0")/../../..
29 ROOT=$(cd "$ROOT" > /dev/null 2>&1 && pwd)
30 TMP=${ROOT}/tmp
31 TEST=${TMP}/test/$$
32 mkdir -p ${TEST}
33
34 cleanup () {
35 echo "Cleaning up (${TEST})"
36 rm -rf "${TEST}"
37 echo ${RESULT}
38 echo
39 }
40
41 trap cleanup EXIT
42
43 banner () {
44 echo "${colourYellow}== $* ==${colourReset}"
45 echo "== Running in ${TEST} =="
46 }
47
48 assert_file_exists () {
49 if test ! -f "$1" ; then
50 echo "Output file '$1' is missing."
51 fail_test
52 fi
53 }
54
55 pass_test () {
56 RESULT="${colourGreen}PASSED [ ${testname} ]${colourReset}"
57 exit 0
58 }
59
60
61 fail_test () {
62 RESULT="${colourRed}FAILED [ ${testname} ]${colourReset}"
63 exit 1
64 }
65
66 sort_diff () {
67 EXP="$1"
68 ACTUAL="$2"
69 EXPECTED_SORTED=${OUTPUT_DIR}/sort_diff.expected.$(basename $EXP)
70 ACTUAL_SORTED=${OUTPUT_DIR}/sort_diff.actual.$(basename $ACTUAL)
71 sort ${EXP} > ${EXPECTED_SORTED}
72 sort ${ACTUAL} > ${ACTUAL_SORTED}
73 diff ${EXPECTED_SORTED} ${ACTUAL_SORTED}
74 }