File: suite.sh

package info (click to toggle)
yui-compressor 2.4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,720 kB
  • sloc: java: 45,217; sh: 81; xml: 68; makefile: 12
file content (62 lines) | stat: -rwxr-xr-x 1,136 bytes parent folder | download | duplicates (2)
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 /usr/share/java/js.jar suite.rhino $testfile
	    )"
         
    else
	    actual="$(
		    java -jar $jar --type $filetype $testfile
	    )"
    fi
	
	if [ "$expected" == "$actual" ]; then
		echo "Passed: $testfile" >&2
	else
		(
			echo "Test failed: $testfile"
			echo ""
			echo "Expected:"
			echo "$expected"
			echo ""
			echo "Actual:"
			echo "$actual"
		) >&2
		return 1
	fi
}


ls *.FAIL 2>/dev/null | 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