Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 62 lines (51 sloc) 1.144 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#!/usr/bin/env bash

cd $(dirname $0)

# Get the jar to use.
jar="$(ls ../build/*.jar | sort | tail -n1)"
echo "jar: $jar"

runtest () {
testfile="$1"
expected=${testfile/\.FAIL/}.min
expected="$(
cat $expected
)"
filetype="$(
echo $testfile | egrep -o '(cs|j)s'
)"

if [ "$2" == "cssminjs" ]; then
actual="$(
java -jar ../lib/rhino-1.7R2.jar suite.rhino $testfile
)"
         
    else
actual="$(
java -jar $jar --type $filetype $testfile
)"
    fi

if [ "$expected" == "$actual" ]; then
echo "Passed: $testfile" > /dev/stderr
else
(
echo "Test failed: $testfile"
echo ""
echo "Expected:"
echo "$expected"
echo ""
echo "Actual:"
echo "$actual"
) > /dev/stderr
return 1
fi
}


ls *.FAIL | while read failtest; do
echo "Failing test: " $failtest > /dev/stderr
runtest $failtest && echo "Test passed, please remove the '.FAIL' from the filename"
done

ls *.{css,js} | while read testfile; do
runtest $testfile || exit 1
done

echo
echo "now testing the JS port of CSSMIN..."
ls *.css | while read testfile; do
runtest $testfile "cssminjs" || exit 1
done

exit 0
Something went wrong with that request. Please try again.