packages feed

hjsmin 0.2.0.3 → 0.2.0.4

raw patch · 4 files changed

+132/−1 lines, 4 filesdep ~bytestring

Dependency ranges changed: bytestring

Files

hjsmin.cabal view
@@ -1,5 +1,5 @@ name:            hjsmin-version:         0.2.0.3+version:         0.2.0.4 license:         BSD3 license-file:    LICENSE author:          Alan Zimmerman <alan.zimm@gmail.com>@@ -17,6 +17,9 @@  Extra-source-files:   Readme.md+  test/cli/core/runner+  test/cli/empty-input/run+  test/cli/minimal-input/run   library
+ test/cli/core/runner view
@@ -0,0 +1,74 @@+if test -d dist-newstyle ; then+    HJSMIN=$(find dist-newstyle -type f -name hjsmin)+elif test -d ../dist-newstyle ; then+    HJSMIN=$(find ../dist-newstyle -type f -name hjsmin)+    fi++echo+echo $HJSMIN+echo++DIFF=${USE_DIFF:-diff -u}++colourReset='\e[0m'+colourGreen='\e[0;32m'+colourRed='\e[0;31m'+colourYellow='\e[0;33m'++testname=$(basename $(dirname $0))++# Failure is the default!+RESULT="FAILED"++type "$HJSMIN" > /dev/null 2>&1 || {+    echo "No hjsmin executable specified on command line or on path."+    exit 1+}++ROOT=$(dirname "$0")/../../..+ROOT=$(cd "$ROOT" > /dev/null 2>&1 && pwd)+TMP=${ROOT}/tmp+TEST=${TMP}/test/$$+mkdir -p ${TEST}++cleanup () {+    echo "Cleaning up (${TEST})"+    rm -rf "${TEST}"+    echo ${RESULT}+    echo+}++trap cleanup EXIT++banner () {+    echo "${colourYellow}== $* ==${colourReset}"+    echo "== Running in ${TEST} =="+}++assert_file_exists () {+    if test ! -f "$1" ; then+        echo "Output file '$1' is missing."+        fail_test+    fi+}++pass_test () {+    RESULT="${colourGreen}PASSED [ ${testname} ]${colourReset}"+    exit 0+}+++fail_test () {+    RESULT="${colourRed}FAILED [ ${testname} ]${colourReset}"+    exit 1+}++sort_diff () {+    EXP="$1"+    ACTUAL="$2"+    EXPECTED_SORTED=${OUTPUT_DIR}/sort_diff.expected.$(basename $EXP)+    ACTUAL_SORTED=${OUTPUT_DIR}/sort_diff.actual.$(basename $ACTUAL)+    sort ${EXP} > ${EXPECTED_SORTED}+    sort ${ACTUAL} > ${ACTUAL_SORTED}+    diff ${EXPECTED_SORTED} ${ACTUAL_SORTED}+}
+ test/cli/empty-input/run view
@@ -0,0 +1,27 @@+#!/bin/sh -eu++. $(dirname $0)/../core/runner++testname="empty-input"++banner "${testname}"+#----------++OUTPUT_DIR=${TEST}++mkdir -p ${OUTPUT_DIR}++INPUT_FILE=${OUTPUT_DIR}/empty+OUTPUT_FILE=${OUTPUT_DIR}/output++# Create a zero length file+touch ${INPUT_FILE}++retcode=0+${HJSMIN} --input ${INPUT_FILE} --output ${OUTPUT_FILE} 2>/dev/null || retcode=1++if test ${retcode} -eq 0 ; then+  fail_test+else+  pass_test+fi
+ test/cli/minimal-input/run view
@@ -0,0 +1,27 @@+#!/bin/sh -eu++. $(dirname $0)/../core/runner++testname="minimal-input"++banner "${testname}"+#----------++OUTPUT_DIR=${TEST}++mkdir -p ${OUTPUT_DIR}++INPUT_FILE=${OUTPUT_DIR}/empty+OUTPUT_FILE=${OUTPUT_DIR}/output++# Create a minimal file+echo '{}' > ${INPUT_FILE}++retcode=0+${HJSMIN} --input ${INPUT_FILE} --output ${OUTPUT_FILE} || retcode=1++if test ${retcode} -eq 0 ; then+  pass_test+else+  fail_test+fi